This method registers a new user or updates an existing user if it already exists and returns the user's ID.
The userData is optional, and can be used to update user information if needed. The "userName" parameter will be used as the primary key here. The username may not be updated through this service call; it will only be used if a new user is being registered.
The "userName" parameter must only contain letters (a-z), digits (0-9), underscore (_), hyphen (-), period (.), and the "at" sign (@).
This method returns the user id of the existing user, or the newly created one.
Optional fields for userData are provided below.
int users.registerOrUpdate ( int vhost, string userName, array userData = array(), mixed returnUserInfo = false )
Name | Type | Required | Default value | Description |
---|---|---|---|---|
vhost | int | Required | none | The id of the vhost. |
userName | string | Required | none | The username for the user. This is used to determine if a user already exists. |
userData | array | Optional | array() | An array with user information. Only user and email are required, other possible key / value pairs are listed below. |
returnUserInfo | mixed | Optional | false |
The different fields available to you within the array. Please note not all of them need to be defined.
Name | Type | Required | Default Value | Description |
---|---|---|---|---|
user | STRING | Required | none | Username for the account. The user parameter must only contain letters (a-z or A-Z), digits (0-9), underscore (_), hyphen (-), period (.), and the "at" sign (@). |
STRING | Required | none | Email address for the account holder. This has to be a properly formatted email address. | |
firstname | STRING | Optional | none | Firstname for the account holder |
lastname | STRING | Optional | none | Lastname for the account holder |
password | STRING | Optional | random string | Password for the account holder (if none is provided the system will generate one and send it to the user) |
address1 | STRING | Optional | none | The account holders address. |
address2 | STRING | Optional | none | A second line for the account holders address. |
city | STRING | Optional | none | The account holders city. |
language | STRING | Optional | none | The language the account holder is using. |
state | STRING | Optional | none | The account holders state/province. |
country | STRING | Optional | none | The account holders country. |
postal | STRING | Optional | none | The account holders zip or postal code. |
birthdate | STRING | Optional | none | The account holders birth date. |
cellphone | STRING | Optional | none | The account holders cell phone. |
phone | STRING | Optional | none | The account holders phone number. |
website | STRING | Optional | none | The account holders website. |
accounttype | STRING | Optional | 0 | The account type for the account holder. |
occupation | STRING | Optional | none | The account holders occupation. |
newsletter | BOOLEAN | Optional | 0 | Whether the account holder wants to receive a newsletter. |
gender | CHAR | Optional | none | The account holders gender, acceptable values are M or F. |
meta | STRING | Optional | none | Any meta data you wish to store about the account holder. |
external_id | STRING | Optional | none | The id provided by a 3rd party external authorization system. NB: This is to be used with 'external_id_provider'. |
external_id_provider | INTEGER | Optional | none | The integer that represents the 3rd party that provided the external id. Possible values are:
NOTE: The external_id_provider is required if external_id is passed. |
<?xml version="1.0" encoding="UTF-8"?> <result>NEW/UPDATED_USER_ID</result>
{ "status": true, "result": NEW/UPDATED_USER_ID }