34 $this->CONFIG = $CONFIG;
49 return _elgg_services()->db->getDataRow(
"SELECT * from {$this->CONFIG->dbprefix}users_entity where guid=$guid");
65 $query =
"UPDATE {$this->CONFIG->dbprefix}entities 66 set enabled='no' where owner_guid={$owner_guid} 67 or container_guid = {$owner_guid}";
101 static $newentity_cache;
103 $newentity_cache = new \ElggMemcache(
'new_entity_cache');
106 if ($newentity_cache) {
111 $query =
"UPDATE {$this->CONFIG->dbprefix}users_entity set banned='yes' where guid=$user_guid";
140 static $newentity_cache;
142 $newentity_cache = new \ElggMemcache(
'new_entity_cache');
145 if ($newentity_cache) {
150 $query =
"UPDATE {$this->CONFIG->dbprefix}users_entity set banned='no' where guid=$user_guid";
176 static $newentity_cache;
178 $newentity_cache = new \ElggMemcache(
'new_entity_cache');
181 if ($newentity_cache) {
182 $newentity_cache->delete($user_guid);
185 $r =
_elgg_services()->db->updateData(
"UPDATE {$this->CONFIG->dbprefix}users_entity set admin='yes' where guid=$user_guid");
212 static $newentity_cache;
214 $newentity_cache = new \ElggMemcache(
'new_entity_cache');
217 if ($newentity_cache) {
218 $newentity_cache->delete($user_guid);
221 $r =
_elgg_services()->db->updateData(
"UPDATE {$this->CONFIG->dbprefix}users_entity set admin='no' where guid=$user_guid");
251 if ((isset($USERNAME_TO_GUID_MAP_CACHE[
$username]))
256 $query =
"SELECT e.* FROM {$this->CONFIG->dbprefix}users_entity u 257 JOIN {$this->CONFIG->dbprefix}entities e ON e.guid = u.guid 258 WHERE u.username = '$username' AND $access";
284 $query =
"SELECT e.* FROM {$this->CONFIG->dbprefix}entities e 285 JOIN {$this->CONFIG->dbprefix}users_entity u ON e.guid = u.guid 286 WHERE email = '$email' AND $access";
288 return _elgg_services()->db->getData($query,
'entity_row_to_elggstar');
326 'seconds' => $seconds,
333 foreach (array(
'seconds',
'limit',
'offset') as
$key) {
348 if (
$data !== null) {
353 $time = time() -
$options[
'seconds'];
359 'joins' => array(
"join {$dbprefix}users_entity u on e.guid = u.guid"),
360 'wheres' => array(
"u.last_action >= {$time}"),
361 'order_by' =>
"u.last_action desc",
382 $name = trim(strip_tags($name));
383 $email = trim($email);
398 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:emailnotvalid'));
402 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:passwordnotvalid'));
406 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:usernamenotvalid'));
410 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:userexists'));
414 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:dupeemail'));
425 $user->setPassword($password);
426 $user->owner_guid = 0;
427 $user->container_guid = 0;
429 if (
$user->save() ===
false) {
436 return $user->getGUID();
463 if (!preg_match(
'~^(\d+)\.([a-zA-Z0-9\-_]+)$~',
$code,
$m)) {
483 if ($result1 && $result2) {
499 'metadata_name' =>
'validated' 524 $query =
"UPDATE {$this->CONFIG->dbprefix}users_entity 525 set prev_last_action = last_action, 526 last_action = {$time} where guid = {$user_guid}";
543 $query =
"UPDATE {$this->CONFIG->dbprefix}users_entity 544 set prev_last_login = last_login, last_login = {$time} where guid = {$user_guid}";
get_user_by_email($email)
Get an array of users from an email address.
setLastLogin($user_guid)
Sets the last logon time of the given user to right now.
_elgg_invalidate_cache_for_entity($guid)
Invalidate this class's entry in the cache.
if($guid==elgg_get_logged_in_user_guid()) $name
_elgg_retrieve_cached_entity($guid)
Retrieve a entity from the cache.
getValidationStatus($user_guid)
Gets the validation status of a user.
disableEntities($owner_guid)
Disables all of a user's entities.
validate_username($username)
Simple function which ensures that a username contains only valid characters.
validate_email_address($address)
Simple validation of a email.
$guid
Removes an admin notice.
unban($user_guid)
Unban a user.
getByEmail($email)
Get an array of users from an email address.
getByUsername($username)
Get user by username.
makeAdmin($user_guid)
Makes user $guid an admin.
get_user_by_username($username)
Get user by username.
ban($user_guid, $reason="")
Ban a user.
execute_delayed_write_query($query, $handler="")
Queue a query for running during shutdown that writes to the database.
validate_password($password)
Simple validation of a password.
sanitise_string($string)
Wrapper function for alternate English spelling (.
set_user_notification_setting($user_guid, $method, $value)
Set a user notification pref.
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
elgg global
Pointer to the global context.
findActive($options=array(), $limit=10, $offset=0, $count=false)
Return users (or the number of them) who have been active within a recent period. ...
removeAdmin($user_guid)
Removes user $guid's admin flag.
validateInviteCode($username, $code)
Validate a user's invite code.
access_get_show_hidden_status()
Return current status of showing disabled entities.
__construct()
Constructor.
setValidationStatus($user_guid, $status, $method= '')
Set the validation status for a user.
setLastAction($user_guid)
Sets the last action time of the given user to right now.
access_show_hidden_entities($show_hidden)
Show or hide disabled entities.
global $USERNAME_TO_GUID_MAP_CACHE
generateInviteCode($username)
Generates a unique invite code for a user.
is_memcache_available()
Return true if memcache is available and configured.
$user_guid
Avatar remove action.
_elgg_get_access_where_sql(array $options=array())
Returns the SQL where clause for enforcing read access to data.
getRow($guid)
Return the user specific details of a user by a row.
get_entity($guid)
Loads and returns an entity object from a guid.