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

Public Member Functions

 __construct (Conf $config, Database $db, EntityTable $entities, EntityCache $cache, EventsService $events)
 Constructor. More...
 
 getRow ($guid)
 Return the user specific details of a user by a row. More...
 
 disableEntities ($owner_guid)
 Disables all of a user's entities. More...
 
 ban ($user_guid, $reason="")
 Ban a user (calls events, stores the reason) More...
 
 markBanned ($guid, $banned)
 Mark a user entity banned or unbanned. More...
 
 unban ($user_guid)
 Unban a user (calls events, removes the reason) More...
 
 makeAdmin ($user_guid)
 Makes user $guid an admin. More...
 
 removeAdmin ($user_guid)
 Removes user $guid's admin flag. More...
 
 getByUsername ($username)
 Get user by username. More...
 
 getByEmail ($email)
 Get an array of users from an email address. More...
 
 findActive ($options=array(), $limit=10, $offset=0, $count=false)
 Return users (or the number of them) who have been active within a recent period. More...
 
 register ($username, $password, $name, $email, $allow_multiple_emails=false)
 Registers a user, returning false if the username already exists. More...
 
 generateInviteCode ($username)
 Generates a unique invite code for a user. More...
 
 validateInviteCode ($username, $code)
 Validate a user's invite code. More...
 
 setValidationStatus ($user_guid, $status, $method= '')
 Set the validation status for a user. More...
 
 getValidationStatus ($user_guid)
 Gets the validation status of a user. More...
 
 setLastAction (ElggUser $user)
 Sets the last action time of the given user to right now. More...
 
 setLastLogin (ElggUser $user)
 Sets the last logon time of the given user to right now. More...
 

Protected Attributes

 $config
 
 $db
 
 $entities
 
 $entity_cache
 
 $events
 
 $table
 

Detailed Description

Definition at line 22 of file UsersTable.php.

Constructor & Destructor Documentation

Elgg\Database\UsersTable::__construct ( Conf  $config,
Database  $db,
EntityTable  $entities,
EntityCache  $cache,
EventsService  $events 
)

Constructor.

Parameters
Conf$configConfig
Database$dbDatabase
EntityTable$entitiesEntity table
EntityCache$cacheEntity cache
EventsService$eventsEvent service

Definition at line 65 of file UsersTable.php.

Member Function Documentation

Elgg\Database\UsersTable::ban (   $user_guid,
  $reason = "" 
)

Ban a user (calls events, stores the reason)

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

Definition at line 113 of file UsersTable.php.

Elgg\Database\UsersTable::disableEntities (   $owner_guid)

Disables all of a user's entities.

Parameters
int$owner_guidThe owner GUID
Returns
bool Depending on success

Definition at line 102 of file UsersTable.php.

Elgg\Database\UsersTable::findActive (   $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 10) 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
ElggUser[]|int

Definition at line 338 of file UsersTable.php.

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

Definition at line 473 of file UsersTable.php.

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

Get an array of users from an email address.

Parameters
string$emailEmail address
Returns
array

Definition at line 303 of file UsersTable.php.

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

Get user by username.

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

Definition at line 270 of file UsersTable.php.

Elgg\Database\UsersTable::getRow (   $guid)

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

Parameters
int$guidThe guid
Returns
mixed private

Definition at line 84 of file UsersTable.php.

Elgg\Database\UsersTable::getValidationStatus (   $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.

Definition at line 522 of file UsersTable.php.

Elgg\Database\UsersTable::makeAdmin (   $user_guid)

Makes user $guid an admin.

Parameters
int$user_guidUser guid
Returns
bool

Definition at line 194 of file UsersTable.php.

Elgg\Database\UsersTable::markBanned (   $guid,
  $banned 
)

Mark a user entity banned or unbanned.

Note
Use ban() or unban()
Parameters
int$guidUser GUID
bool$bannedMark the user banned?
Returns
int Num rows affected

Definition at line 146 of file UsersTable.php.

Elgg\Database\UsersTable::register (   $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 407 of file UsersTable.php.

Elgg\Database\UsersTable::removeAdmin (   $user_guid)

Removes user $guid's admin flag.

Parameters
int$user_guidUser GUID
Returns
bool

Definition at line 231 of file UsersTable.php.

Elgg\Database\UsersTable::setLastAction ( ElggUser  $user)

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

See also
_elgg_session_boot The session boot calls this at the beginning of every request
Parameters
ElggUser$userUser entity
Returns
void

Definition at line 538 of file UsersTable.php.

Elgg\Database\UsersTable::setLastLogin ( ElggUser  $user)

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

Parameters
ElggUser$userUser entity
Returns
void

Definition at line 582 of file UsersTable.php.

Elgg\Database\UsersTable::setValidationStatus (   $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

Definition at line 506 of file UsersTable.php.

Elgg\Database\UsersTable::unban (   $user_guid)

Unban a user (calls events, removes the reason)

Parameters
int$user_guidUnban a user
Returns
bool

Definition at line 168 of file UsersTable.php.

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

Validate a user's invite code.

Parameters
string$usernameThe username
string$codeThe invite code
Returns
bool
See also
generateInviteCode

Definition at line 487 of file UsersTable.php.

Member Data Documentation

Elgg\Database\UsersTable::$config
protected

Definition at line 29 of file UsersTable.php.

Elgg\Database\UsersTable::$db
protected

Definition at line 34 of file UsersTable.php.

Elgg\Database\UsersTable::$entities
protected

Definition at line 39 of file UsersTable.php.

Elgg\Database\UsersTable::$entity_cache
protected

Definition at line 44 of file UsersTable.php.

Elgg\Database\UsersTable::$events
protected

Definition at line 49 of file UsersTable.php.

Elgg\Database\UsersTable::$table
protected

Definition at line 54 of file UsersTable.php.


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