Resource functions
Collection functions
Search functions
IIIF
Metadata functions
User functions
System
Message functions
Plugin functions

new_user

Create a user record. Use the returned ID to then call save_user() with the user details.

Variable Description Data type Default value
$username The username of the user string N/A
$usergroup The user group to assign upon creation int 0

Response

The actual value will be in the data.ref key of the payload. If successful, a 200 HTTP status will be returned.

Otherwise a 409 HTTP status with a data.ref value representing different scenarios:

  • false if that username already exists
  • -2 if the user limit has been reached

Or a 403 HTTP status when there's a permission issue.

Examples

New user created, use data.ref to get the new user ID (HTTP status - 200):

Array
(
    [status] => success
    [data] => {
"ref": 41
} )

Username already exists (HTTP status - 409):

Array
(
    "status": "fail",
    "data": {
        "ref": false
    }
)

No access to carry out the action (HTTP status - 403):

Array
(
    [status] => fail
    [data] => Array
        (
            [message] => Permission denied.
        )
)