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");
266 if ((isset($USERNAME_TO_GUID_MAP_CACHE[
$username]))
271 $query =
"SELECT e.* FROM {$this->CONFIG->dbprefix}users_entity u 272 JOIN {$this->CONFIG->dbprefix}entities e ON e.guid = u.guid 273 WHERE u.username = '$username' AND $access";
299 $query =
"SELECT e.* FROM {$this->CONFIG->dbprefix}entities e 300 JOIN {$this->CONFIG->dbprefix}users_entity u ON e.guid = u.guid 301 WHERE email = '$email' AND $access";
303 return _elgg_services()->db->getData($query,
'entity_row_to_elggstar');
341 'seconds' => $seconds,
348 foreach (array(
'seconds',
'limit',
'offset') as
$key) {
363 if (
$data !== null) {
368 $time = time() -
$options[
'seconds'];
374 'joins' => array(
"join {$dbprefix}users_entity u on e.guid = u.guid"),
375 'wheres' => array(
"u.last_action >= {$time}"),
376 'order_by' =>
"u.last_action desc",
397 $name = trim(strip_tags($name));
398 $email = trim($email);
413 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:emailnotvalid'));
417 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:passwordnotvalid'));
421 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:usernamenotvalid'));
425 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:userexists'));
429 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:dupeemail'));
440 $user->setPassword($password);
441 $user->owner_guid = 0;
442 $user->container_guid = 0;
444 if (
$user->save() ===
false) {
451 return $user->getGUID();
478 if (!preg_match(
'~^(\d+)\.(\w+)$~',
$code,
$m)) {
485 return $crypto->areEqual($mac, $crypto->getHmac($time .
$username));
499 if ($result1 && $result2) {
515 'metadata_name' =>
'validated' 540 $query =
"UPDATE {$this->CONFIG->dbprefix}users_entity 541 set prev_last_action = last_action, 542 last_action = {$time} where guid = {$user_guid}";
559 $query =
"UPDATE {$this->CONFIG->dbprefix}users_entity 560 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.
if(!$autoload_available) _elgg_services()
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)
Sends 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.