Elgg  Version 4.3
Public Member Functions | Protected Attributes | List of all members
Elgg\Database\UsersTable Class Reference

Users helper service. More...

Public Member Functions

 __construct (Config $config, Database $db, MetadataTable $metadata)
 Constructor. More...
 
 getByUsername ($username)
 Get user by username. More...
 
 getByEmail ($email)
 Get an array of users from an email address. More...
 
 findActive (array $options=[])
 Return users (or the number of them) who have been active within a recent period. More...
 
 generateInviteCode (string $username)
 Generates a unique invite code for a user. More...
 
 validateInviteCode (string $username, string $code)
 Validate a user's invite code. More...
 

Protected Attributes

 $config
 
 $db
 
 $metadata
 

Detailed Description

Users helper service.

Definition at line 16 of file UsersTable.php.

Constructor & Destructor Documentation

Elgg\Database\UsersTable::__construct ( Config  $config,
Database  $db,
MetadataTable  $metadata 
)

Constructor.

Parameters
Config$configConfig
Database$dbDatabase
MetadataTable$metadataMetadata table

Definition at line 42 of file UsersTable.php.

Member Function Documentation

Elgg\Database\UsersTable::findActive ( array  $options = [])

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 10)
  • offset (int) => Offset (default 0)
  • count (bool) => Return a count instead of users? (default false)
Returns
[]|int

Definition at line 126 of file UsersTable.php.

Elgg\Database\UsersTable::generateInviteCode ( 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
self::validateInviteCode()

Definition at line 175 of file UsersTable.php.

Elgg\Database\UsersTable::getByEmail (   $email)

Get an array of users from an email address.

Parameters
string$emailEmail address
Returns
[]

Definition at line 94 of file UsersTable.php.

Elgg\Database\UsersTable::getByUsername (   $username)

Get user by username.

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

Definition at line 55 of file UsersTable.php.

Elgg\Database\UsersTable::validateInviteCode ( string  $username,
string  $code 
)

Validate a user's invite code.

Parameters
string$usernameThe username
string$codeThe invite code
Returns
bool
See also
self::generateInviteCode()

Definition at line 191 of file UsersTable.php.

Member Data Documentation

Elgg\Database\UsersTable::$config
protected

Definition at line 23 of file UsersTable.php.

Elgg\Database\UsersTable::$db
protected

Definition at line 28 of file UsersTable.php.

Elgg\Database\UsersTable::$metadata
protected

Definition at line 33 of file UsersTable.php.


The documentation for this class was generated from the following file: