Elgg  Version 2.3
Namespaces | Functions | Variables
users.php File Reference

Go to the source code of this file.

Namespaces

 Elgg\Core
 Activate a plugin or plugins.
 

Functions

 get_user_entity_as_row ($guid)
 Return the user specific details of a user by a row. More...
 
 disable_user_entities ($owner_guid)
 Disables all of a user's entities. More...
 
 ban_user ($user_guid, $reason="")
 Ban a user. More...
 
 unban_user ($user_guid)
 Unban a user. More...
 
 make_user_admin ($user_guid)
 Makes user $guid an admin. More...
 
 remove_user_admin ($user_guid)
 Removes user $guid's admin flag. More...
 
 get_user ($guid)
 Get a user object from a GUID. More...
 
 get_user_by_username ($username)
 Get user by username. More...
 
 get_user_by_code ($hash)
 Get user by persistent login password. More...
 
 get_user_by_email ($email)
 Get an array of users from an email address. More...
 
 find_active_users ($options=array(), $limit=10, $offset=0, $count=false)
 Return users (or the number of them) who have been active within a recent period. More...
 
 send_new_password_request ($user_guid)
 Generate and send a password request email to a given user's registered email address. More...
 
 force_user_password_reset ($user_guid, $password)
 Low level function to reset a given user's password. More...
 
 execute_new_password_request ($user_guid, $conf_code, $password=null)
 Validate and change password for a user. More...
 
 generate_random_cleartext_password ()
 Generate a random 12 character clear text password. More...
 
 validate_username ($username)
 Simple function which ensures that a username contains only valid characters. More...
 
 validate_password ($password)
 Simple validation of a password. More...
 
 validate_email_address ($address)
 Simple validation of a email. More...
 
 register_user ($username, $password, $name, $email, $allow_multiple_emails=false)
 Registers a user, returning false if the username already exists. More...
 
 generate_invite_code ($username)
 Generates a unique invite code for a user. More...
 
 elgg_validate_invite_code ($username, $code)
 Validate a user's invite code. More...
 
 elgg_set_user_validation_status ($user_guid, $status, $method= '')
 Set the validation status for a user. More...
 
 elgg_get_user_validation_status ($user_guid)
 Gets the validation status of a user. More...
 
 elgg_user_account_page_handler ($page_elements, $handler)
 Page handler for account related pages. More...
 
 elgg_get_registration_url (array $query=[], $fragment= '')
 Returns site's registration URL Triggers a 'registration_url', 'site' plugin hook 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=[], $fragment= '')
 Returns site's login URL Triggers a 'login_url', 'site' plugin hook that can be used by plugins to alter the default login URL. More...
 
 set_last_action ($user_guid)
 Sets the last action time of the given user to right now. More...
 
 set_last_login ($user_guid)
 Sets the last logon time of the given user to right now. More...
 
 user_create_hook_add_site_relationship ($event, $object_type, $object)
 Creates a relationship between this site and the user. More...
 
 user_avatar_hook ($hook, $entity_type, $returnvalue, $params)
 Serves the user's avatar. More...
 
 elgg_user_hover_menu ($hook, $type, $return, $params)
 Setup the default user hover menu private. More...
 
 elgg_users_setup_entity_menu ($hook, $type, $return, $params)
 Setup the menu shown with an entity. More...
 
 elgg_profile_fields_setup ()
 This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit add and delete fields. More...
 
 elgg_avatar_page_handler ($page)
 Avatar page handler. More...
 
 elgg_profile_page_handler ($page)
 Profile page handler. More...
 
 users_pagesetup ()
 Sets up user-related menu items. More...
 
 _elgg_user_set_icon_file ($hook, $type, $icon, $params)
 Set user icon file. More...
 
 users_init ()
 Users initialisation function, which establishes the page handler. More...
 
 users_test ($hook, $type, $value, $params)
 Runs unit tests for . More...
 

Variables

return function (\Elgg\EventsService $events,\Elgg\HooksRegistrationService $hooks)
 

Function Documentation

_elgg_user_set_icon_file (   $hook,
  $type,
  $icon,
  $params 
)

Set user icon file.

Parameters
string$hook"entity:icon:file"
string$type"user"
\ElggIcon$iconIcon file
array$paramsHook params
Returns

Definition at line 801 of file users.php.

ban_user (   $user_guid,
  $reason = "" 
)

Ban a user.

Parameters
int$user_guidThe user guid
string$reasonA reason
Returns
bool

Definition at line 41 of file users.php.

disable_user_entities (   $owner_guid)

Disables all of a user's entities.

Parameters
int$owner_guidThe owner GUID
Returns
bool Depending on success

Definition at line 29 of file users.php.

elgg_avatar_page_handler (   $page)

Avatar page handler.

/avatar/edit/<username>

Parameters
array$page
Returns
bool private

Definition at line 706 of file users.php.

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

Returns site's login URL Triggers a 'login_url', 'site' plugin hook 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 426 of file users.php.

elgg_get_registration_url ( array  $query = [],
  $fragment = '' 
)

Returns site's registration URL Triggers a 'registration_url', 'site' plugin hook 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$queryAn array of query elements
string$fragmentFragment identifier
Returns
string

Definition at line 411 of file users.php.

elgg_get_user_validation_status (   $user_guid)

Gets the validation status of a user.

Parameters
int$user_guidThe user's GUID
Returns
bool|null Null means status was not set for this user.
Since
1.8.0

Definition at line 366 of file users.php.

elgg_profile_fields_setup ( )

This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit add and delete fields.

Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all other plugins have initialised. private

Definition at line 651 of file users.php.

elgg_profile_page_handler (   $page)

Profile page handler.

Parameters
array$page
Returns
bool private

Definition at line 731 of file users.php.

elgg_set_user_validation_status (   $user_guid,
  $status,
  $method = '' 
)

Set the validation status for a user.

Parameters
int$user_guidThe user's GUID
bool$statusValidated (true) or unvalidated (false)
string$methodOptional method to say how a user was validated
Returns
bool
Since
1.8.0

Definition at line 355 of file users.php.

elgg_user_account_page_handler (   $page_elements,
  $handler 
)

Page handler for account related pages.

Parameters
array$page_elementsPage elements
string$handlerThe handler string
Returns
bool private

Definition at line 379 of file users.php.

elgg_user_hover_menu (   $hook,
  $type,
  $return,
  $params 
)

Setup the default user hover menu private.

Definition at line 516 of file users.php.

elgg_users_setup_entity_menu (   $hook,
  $type,
  $return,
  $params 
)

Setup the menu shown with an entity.

Parameters
string$hook
string$type
array$return
array$params
Returns
array

private

Definition at line 605 of file users.php.

elgg_validate_invite_code (   $username,
  $code 
)

Validate a user's invite code.

Parameters
string$usernameThe username
string$codeThe invite code
Returns
bool
See also
generate_invite_code
Since
1.10

Definition at line 342 of file users.php.

execute_new_password_request (   $user_guid,
  $conf_code,
  $password = null 
)

Validate and change password for a user.

Parameters
int$user_guidThe user id
string$conf_codeConfirmation code as sent in the request email.
string$passwordOptional new password, if not randomly generated.
Returns
bool True on success

Definition at line 180 of file users.php.

find_active_users (   $options = array(),
  $limit = 10,
  $offset = 0,
  $count = false 
)

Return users (or the number of them) who have been active within a recent period.

Parameters
array$optionsArray of options with keys:

seconds (int) => Length of period (default 600 = 10min) limit (int) => Limit (default from settings) offset (int) => Offset (default 0) count (bool) => Return a count instead of users? (default false)

Formerly this was the seconds parameter.

Parameters
int$limitLimit (deprecated usage, use $options)
int$offsetOffset (deprecated usage, use $options)
bool$countCount (deprecated usage, use $options)
Returns
[]|int

Definition at line 142 of file users.php.

force_user_password_reset (   $user_guid,
  $password 
)

Low level function to reset a given user's password.

This can only be called from execute_new_password_request().

Parameters
int$user_guidThe user.
string$passwordText (which will then be converted into a hash and stored)
Returns
bool

Definition at line 167 of file users.php.

generate_invite_code (   $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

Definition at line 328 of file users.php.

generate_random_cleartext_password ( )

Generate a random 12 character clear text password.

Returns
string

Definition at line 189 of file users.php.

get_user (   $guid)

Get a user object from a GUID.

This function returns an from a given GUID.

Parameters
int$guidThe GUID
Returns
|false
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 87 of file users.php.

get_user_by_code (   $hash)

Get user by persistent login password.

Parameters
string$hashHash of the persistent login password
Returns

Definition at line 109 of file users.php.

get_user_by_email (   $email)

Get an array of users from an email address.

Parameters
string$emailEmail address.
Returns
array

Definition at line 120 of file users.php.

get_user_by_username (   $username)

Get user by username.

Parameters
string$usernameThe user's username
Returns
|false Depending on success

Definition at line 98 of file users.php.

get_user_entity_as_row (   $guid)

Return the user specific details of a user by a row.

Parameters
int$guidThe guid
Returns
mixed private

Definition at line 18 of file users.php.

make_user_admin (   $user_guid)

Makes user $guid an admin.

Parameters
int$user_guidUser guid
Returns
bool

Definition at line 63 of file users.php.

register_user (   $username,
  $password,
  $name,
  $email,
  $allow_multiple_emails = false 
)

Registers a user, returning false if the username already exists.

Parameters
string$usernameThe username of the new user
string$passwordThe 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
int|false The new user's GUID; false on failure
Exceptions
RegistrationException

Definition at line 316 of file users.php.

remove_user_admin (   $user_guid)

Removes user $guid's admin flag.

Parameters
int$user_guidUser GUID
Returns
bool

Definition at line 74 of file users.php.

send_new_password_request (   $user_guid)

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

Parameters
int$user_guidUser GUID
Returns
bool

Definition at line 153 of file users.php.

set_last_action (   $user_guid)

Sets the last action time of the given user to right now.

Parameters
int$user_guidThe user GUID
Returns
void

Definition at line 438 of file users.php.

set_last_login (   $user_guid)

Sets the last logon time of the given user to right now.

Parameters
int$user_guidThe user GUID
Returns
void

Definition at line 452 of file users.php.

unban_user (   $user_guid)

Unban a user.

Parameters
int$user_guidUnban a user.
Returns
bool

Definition at line 52 of file users.php.

user_avatar_hook (   $hook,
  $entity_type,
  $returnvalue,
  $params 
)

Serves the user's avatar.

Parameters
string$hook
string$entity_type
string$returnvalue
array$params
Returns
string private

Definition at line 484 of file users.php.

user_create_hook_add_site_relationship (   $event,
  $object_type,
  $object 
)

Creates a relationship between this site and the user.

Parameters
string$eventcreate
string$object_typeuser
\ElggUser$objectUser object
Returns
void private

Definition at line 470 of file users.php.

users_init ( )

Users initialisation function, which establishes the page handler.

Returns
void private

Definition at line 818 of file users.php.

users_pagesetup ( )

Sets up user-related menu items.

Returns
void private

Definition at line 748 of file users.php.

users_test (   $hook,
  $type,
  $value,
  $params 
)

Runs unit tests for .

Parameters
string$hookunit_test
string$typesystem
mixed$valueArray of tests
mixed$paramsParams
Returns
array private

Definition at line 862 of file users.php.

validate_email_address (   $address)

Simple validation of a email.

Parameters
string$addressEmail address
Exceptions
RegistrationExceptionon invalid
Returns
bool

Definition at line 292 of file users.php.

validate_password (   $password)

Simple validation of a password.

Parameters
string$passwordClear text password
Returns
bool
Exceptions
RegistrationExceptionon invalid

Definition at line 267 of file users.php.

validate_username (   $username)

Simple function which ensures that a username contains only valid characters.

This should only permit chars that are valid on the file system as well.

Parameters
string$usernameUsername
Returns
bool
Exceptions
RegistrationExceptionon invalid

Definition at line 205 of file users.php.

Variable Documentation

Definition at line 868 of file users.php.