70 $this->
table = $this->db->prefix .
"users_entity";
72 $this->entity_cache = $cache;
86 SELECT * FROM {$this->table} 92 return $this->db->getDataRow($sql, null,
$params);
103 return $this->entities->disableEntities(
$owner_guid);
121 if (!$this->events->trigger(
'ban',
'user',
$user)) {
149 UPDATE {$this->table} 155 ':banned' => $banned ?
'yes' :
'no',
156 ':guid' => (int)
$guid,
159 return $this->db->updateData($query,
true,
$params);
176 if (!$this->events->trigger(
'unban',
'user',
$user)) {
201 if (!$this->events->trigger(
'make_admin',
'user',
$user)) {
206 UPDATE {$this->table} 218 if ($this->db->updateData($query,
true,
$params)) {
239 if (!$this->events->trigger(
'remove_admin',
'user',
$user)) {
244 UPDATE {$this->table} 256 if ($this->db->updateData($query,
true,
$params)) {
286 $users = $this->entities->getEntitiesFromAttributes([
288 'attribute_name_value_pairs' => [
289 'name' =>
'username',
308 $users = $this->entities->getEntitiesFromAttributes([
310 'attribute_name_value_pairs' => [
351 $limit = $this->config->get(
'default_limit');
355 'seconds' => $seconds,
362 foreach (array(
'seconds',
'limit',
'offset') as
$key) {
377 if (
$data !== null) {
381 $dbprefix = $this->config->get(
'dbprefix');
388 'joins' => array(
"join {$dbprefix}users_entity u on e.guid = u.guid"),
389 'wheres' => array(
"u.last_action >= {$time}"),
390 'order_by' =>
"u.last_action desc",
411 $name = trim(strip_tags($name));
412 $email = trim($email);
415 if (empty(
$username) || empty($password) || empty($name) || empty($email)) {
451 $user->setPassword($password);
452 $user->owner_guid = 0;
453 $user->container_guid = 0;
455 if (
$user->save() ===
false) {
460 $user->setNotificationSetting(
'email',
true);
462 return $user->getGUID();
489 if (!preg_match(
'~^(\d+)\.([a-zA-Z0-9\-_]+)$~',
$code,
$m)) {
509 if ($result1 && $result2) {
527 return (
bool)
$user->validated;
542 if ($user->last_action == $time) {
548 UPDATE {$this->table} 550 prev_last_action = last_action, 551 last_action = :last_action 556 ':last_action' => $time,
557 ':guid' => (int) $user->guid,
560 $user->prev_last_action = $user->last_action;
561 $user->last_action = $time;
565 $this->entity_cache->set($user);
570 register_shutdown_function(
function ()
use ($user, $time) {
571 $this->entities->updateLastAction($user, $time);
586 if ($user->last_login == $time) {
592 UPDATE {$this->table} 594 prev_last_login = last_login, 595 last_login = :last_login 600 ':last_login' => $time,
601 ':guid' => (int) $user->guid,
604 $user->prev_last_login = $user->last_login;
605 $user->last_login = $time;
609 $this->entity_cache->set($user);
614 register_shutdown_function(
function ()
use ($user) {
get_user_by_email($email)
Get an array of users from an email address.
setLastLogin(ElggUser $user)
Sets the last logon time of the given user to right now.
_elgg_invalidate_cache_for_entity($entity_guid)
Invalidate entity cache.
if($guid==elgg_get_logged_in_user_guid()) $name
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.
setLastAction(ElggUser $user)
Sets the last action time of the given user to right now.
getCurrentTime($modifier= '')
Get the (cloned) time.
validate_email_address($address)
Simple validation of a email.
$guid
Removes an admin notice.
_elgg_get_memcache($namespace= 'default')
Get a namespaced ElggMemcache object (if memcache is available) or a null cache.
storeInPersistedCache(\ElggSharedMemoryCache $cache, $last_action=0)
Cache the entity in a persisted cache.
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.
_elgg_invalidate_memcache_for_entity($entity_guid)
Invalidate an entity in memcache.
__construct(Conf $config, Database $db, EntityTable $entities, EntityCache $cache, EventsService $events)
Constructor.
ban($user_guid, $reason="")
Ban a user (calls events, stores the reason)
validate_password($password)
Simple validation of a password.
execute_delayed_write_query($query, $callback=null, array $params=[])
Queue a query for running during shutdown that writes to the database.
Volatile cache for entities.
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.
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.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
access_get_show_hidden_status()
Return current status of showing disabled entities.
setValidationStatus($user_guid, $status, $method= '')
Set the validation status for a user.
access_show_hidden_entities($show_hidden)
Show or hide disabled entities.
generateInviteCode($username)
Generates a unique invite code for a user.
trait TimeUsing
Adds methods for setting the current time (for testing)
$user_guid
Avatar remove action.
getRow($guid)
Return the user specific details of a user by a row.
markBanned($guid, $banned)
Mark a user entity banned or unbanned.
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
get_entity($guid)
Loads and returns an entity object from a guid.