USER Methods

register()

Checks if user already exists and registers a new user. Upon registration the user will be assigned a hash() key which can be used to activate() the user account. In order to establish a double-opt-in registration the hash-key needs to be sent to the user. To register a user an email-address or a nickname is required together with a password. Alternatively you may use create() to setup a user account with an e-mail address but without a password.

int register( string nick, string mail, string pass [, array values [, array groups ]])

Return

Returns database index of new user or one of the following error codes:

-1: required data missing
-2: nick invalid
-3: mail invalid
-4: password invalid
-5: nick already exsits
-6: e-mail already exists
-7: additional data invalid
-8: additional groups do not exist
-9: database error

Parameter
Description
nickNickname
mailE-Mail-Address
passPassword
valuesAdditional user data from the database table sys_user_sub
groupsAssign new user to these groups

Required data missing (nick or email)

$USER->register("", "", "password25")
RETURN: -1

Nickname invalid

$USER->register("ab", "", "password25")
RETURN: -2

Invalid e-mail-address

$USER->register("abc", "test@mail", "password25")
RETURN: -3

Password invalid

$USER->register("", "test@mail.com", "pw")
RETURN: -4

Nickname already taken

$USER->register("test", "", "opus9user")
RETURN: -5

E-Mail already registered

$USER->register("test123", "testuser@opus9.org", "opus9user")
RETURN: 796

Register new user

$USER->register("test123", "test123@opus9.org", "opus9user")
RETURN: 789