34 $this->CONFIG = $CONFIG;
47 return _elgg_services()->db->getDataRow(
"SELECT * from {$this->CONFIG->dbprefix}users_entity where guid=$guid");
62 $query =
"UPDATE {$this->CONFIG->dbprefix}entities 63 set enabled='no' where owner_guid={$owner_guid} 64 or container_guid = {$owner_guid}";
96 static $newentity_cache;
98 $newentity_cache = new \ElggMemcache(
'new_entity_cache');
101 if ($newentity_cache) {
125 $banned = $banned ?
'yes' :
'no';
127 UPDATE {$this->CONFIG->dbprefix}users_entity 128 SET banned = '$banned' 152 static $newentity_cache;
154 $newentity_cache = new \ElggMemcache(
'new_entity_cache');
157 if ($newentity_cache) {
184 static $newentity_cache;
186 $newentity_cache = new \ElggMemcache(
'new_entity_cache');
189 if ($newentity_cache) {
190 $newentity_cache->delete($user_guid);
193 $r =
_elgg_services()->db->updateData(
"UPDATE {$this->CONFIG->dbprefix}users_entity set admin='yes' where guid=$user_guid");
220 static $newentity_cache;
222 $newentity_cache = new \ElggMemcache(
'new_entity_cache');
225 if ($newentity_cache) {
226 $newentity_cache->delete($user_guid);
229 $r =
_elgg_services()->db->updateData(
"UPDATE {$this->CONFIG->dbprefix}users_entity set admin='no' where guid=$user_guid");
259 if ((isset($USERNAME_TO_GUID_MAP_CACHE[
$username]))
264 $query =
"SELECT e.* FROM {$this->CONFIG->dbprefix}users_entity u 265 JOIN {$this->CONFIG->dbprefix}entities e ON e.guid = u.guid 266 WHERE u.username = '$username' AND $access";
292 $query =
"SELECT e.* FROM {$this->CONFIG->dbprefix}entities e 293 JOIN {$this->CONFIG->dbprefix}users_entity u ON e.guid = u.guid 294 WHERE email = '$email' AND $access";
296 return _elgg_services()->db->getData($query,
'entity_row_to_elggstar');
334 'seconds' => $seconds,
341 foreach (array(
'seconds',
'limit',
'offset') as
$key) {
356 if (
$data !== null) {
361 $time = time() -
$options[
'seconds'];
367 'joins' => array(
"join {$dbprefix}users_entity u on e.guid = u.guid"),
368 'wheres' => array(
"u.last_action >= {$time}"),
369 'order_by' =>
"u.last_action desc",
390 $name = trim(strip_tags($name));
391 $email = trim($email);
406 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:emailnotvalid'));
410 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:passwordnotvalid'));
414 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:usernamenotvalid'));
418 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:userexists'));
422 throw new \RegistrationException(
_elgg_services()->translator->translate(
'registration:dupeemail'));
433 $user->setPassword($password);
434 $user->owner_guid = 0;
435 $user->container_guid = 0;
437 if (
$user->save() ===
false) {
444 return $user->getGUID();
471 if (!preg_match(
'~^(\d+)\.([a-zA-Z0-9\-_]+)$~',
$code,
$m)) {
491 if ($result1 && $result2) {
507 'metadata_name' =>
'validated' 532 $query =
"UPDATE {$this->CONFIG->dbprefix}users_entity 533 set prev_last_action = last_action, 534 last_action = {$time} where guid = {$user_guid}";
551 $query =
"UPDATE {$this->CONFIG->dbprefix}users_entity 552 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 (calls events, removes the reason)
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 (calls events, stores the reason)
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.
markBanned($guid, $banned)
Mark a user entity banned or unbanned.
get_entity($guid)
Loads and returns an entity object from a guid.