Elgg  Version 6.1
Functions
users.php File Reference

Go to the source code of this file.

Functions

 get_user (int $guid)
 Elgg users Functions to manage multiple or single users in an Elgg install. More...
 
 elgg_get_user_by_username (string $username, bool $try_email=false)
 Get a user by username. More...
 
 elgg_get_user_by_email (string $email)
 Get a user from an email address. More...
 
 elgg_request_new_password (\ElggUser $user)
 Generate and send a password request email to a given user's registered email address. More...
 
 elgg_save_new_password (\ElggUser $user, string $conf_code, string $password=null)
 Validate and change password for a user. More...
 
 elgg_generate_password ()
 Generate a random 12 character clear text password. More...
 
 elgg_register_user (array $params=[])
 Registers a user. More...
 
 elgg_validate_registration_data (string $username, string|array $password, string $name, string $email, bool $allow_multiple_emails=false)
 Assert that given registration details are valid and can be used to register the user. More...
 
 elgg_generate_invite_code (string $username)
 Generates a unique invite code for a user. More...
 
 elgg_validate_invite_code (string $username, string $code)
 Validate a user's invite code. More...
 
 elgg_get_registration_url (array $parameters=[], string $fragment= '')
 Returns site's registration URL Triggers a 'registration_url', 'site' event that can be used by plugins to alter the default registration URL and append query elements, such as an invitation code and inviting user's guid. More...
 
 elgg_get_login_url (array $query=[], string $fragment= '')
 Returns site's login URL Triggers a 'login_url', 'site' event that can be used by plugins to alter the default login URL. More...
 
 elgg_get_user_by_persistent_token (string $token)
 Get a user based on a persistent login token. More...
 

Function Documentation

elgg_generate_invite_code ( string  $username)

Generates a unique invite code for a user.

Parameters
string$usernameThe username of the user sending the invitation
Returns
string Invite code
See also
elgg_validate_invite_code()
Since
4.3

Definition at line 184 of file users.php.

elgg_generate_password ( )

Generate a random 12 character clear text password.

Returns
string
Since
4.3

Definition at line 134 of file users.php.

elgg_get_login_url ( array  $query = [],
string  $fragment = '' 
)

Returns site's login URL Triggers a 'login_url', 'site' event that can be used by plugins to alter the default login URL.

Parameters
array$queryAn array of query elements
string$fragmentFragment identifier (e.g. #login-dropdown-box)
Returns
string

Definition at line 228 of file users.php.

elgg_get_registration_url ( array  $parameters = [],
string  $fragment = '' 
)

Returns site's registration URL Triggers a 'registration_url', 'site' event that can be used by plugins to alter the default registration URL and append query elements, such as an invitation code and inviting user's guid.

Parameters
array$parametersAn array of query elements
string$fragmentFragment identifier
Returns
string

Definition at line 213 of file users.php.

elgg_get_user_by_email ( string  $email)

Get a user from an email address.

Parameters
string$emailEmail address
Returns
|null
Since
5.0

Definition at line 79 of file users.php.

elgg_get_user_by_persistent_token ( string  $token)

Get a user based on a persistent login token.

Please note the token should be the raw token, not hashed in any way.

Parameters
string$tokenthe persistent token
Returns
|null
Since
4.1

Definition at line 244 of file users.php.

elgg_get_user_by_username ( string  $username,
bool  $try_email = false 
)

Get a user by username.

Parameters
string$usernameThe user's username
bool$try_emailIf the username contains an '@' try based on email first
Returns
|null
Since
5.0

Definition at line 31 of file users.php.

elgg_register_user ( array  $params = [])

Registers a user.

Parameters
array$paramsArray of options with keys: (string) username => The username of the new user (string) password => The password (string) name => The user's display name (string) email => The user's email address (string) subtype => (optional) Subtype of the user entity (string) language => (optional) user language (defaults to current language) (bool) allow_multiple_emails => (optional) Allow the same email address to be registered multiple times (default false) (bool) validated => (optional) Is the user validated (default true)
Returns
Exceptions

Definition at line 154 of file users.php.

elgg_request_new_password ( \ElggUser  $user)

Generate and send a password request email to a given user's registered email address.

Parameters
\ElggUser$userthe user to notify
Returns
void
Since
4.3

Definition at line 108 of file users.php.

elgg_save_new_password ( \ElggUser  $user,
string  $conf_code,
string  $password = null 
)

Validate and change password for a user.

Parameters
\ElggUser$userThe user
string$conf_codeConfirmation code as sent in the request email.
string$passwordOptional new password, if not randomly generated.
Returns
bool
Since
4.3

Definition at line 123 of file users.php.

elgg_validate_invite_code ( string  $username,
string  $code 
)

Validate a user's invite code.

Parameters
string$usernameThe username
string$codeThe invite code
Returns
bool
See also
elgg_generate_invite_code()
Since
1.10

Definition at line 198 of file users.php.

elgg_validate_registration_data ( string  $username,
string|array  $password,
string  $name,
string  $email,
bool  $allow_multiple_emails = false 
)

Assert that given registration details are valid and can be used to register the user.

Parameters
string$usernameThe username of the new user
string | array$passwordThe password Can be an array [$password, $confirm_password]
string$nameThe user's display name
string$emailThe user's email address
bool$allow_multiple_emailsAllow the same email address to be registered multiple times?
Returns

Definition at line 171 of file users.php.

get_user ( int  $guid)

Elgg users Functions to manage multiple or single users in an Elgg install.

Get a user object from a GUID.

This function returns an from a given GUID.

Parameters
int$guidThe GUID
Returns
|null

Definition at line 16 of file users.php.