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",
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,
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,
605 $user->last_login = $time;
609 $this->entity_cache->set(
$user);
614 register_shutdown_function(
function () use (
$user) {
if($guid==elgg_get_logged_in_user_guid()) $name
$user_guid
Avatar remove action.
_elgg_invalidate_cache_for_entity($entity_guid)
Invalidate entity cache.
Volatile cache for entities.
Access to configuration values.
getRow($guid)
Return the user specific details of a user by a row.
markBanned($guid, $banned)
Mark a user entity banned or unbanned.
removeAdmin($user_guid)
Removes user $guid's admin flag.
setValidationStatus($user_guid, $status, $method='')
Set the validation status for a user.
disableEntities($owner_guid)
Disables all of a user's entities.
generateInviteCode($username)
Generates a unique invite code for a user.
getByEmail($email)
Get an array of users from an email address.
findActive($options=array(), $limit=10, $offset=0, $count=false)
Return users (or the number of them) who have been active within a recent period.
__construct(Conf $config, Database $db, EntityTable $entities, EntityCache $cache, EventsService $events)
Constructor.
validateInviteCode($username, $code)
Validate a user's invite code.
unban($user_guid)
Unban a user (calls events, removes the reason)
getValidationStatus($user_guid)
Gets the validation status of a user.
ban($user_guid, $reason="")
Ban a user (calls events, stores the reason)
setLastAction(ElggUser $user)
Sets the last action time of the given user to right now.
getByUsername($username)
Get user by username.
makeAdmin($user_guid)
Makes user $guid an admin.
setLastLogin(ElggUser $user)
Sets the last logon time of the given user to right now.
$guid
Removes an admin notice.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
access_get_show_hidden_status()
Return current status of showing disabled entities.
access_show_hidden_entities($show_hidden)
Show or hide disabled entities.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
execute_delayed_write_query($query, $callback=null, array $params=[])
Queue a query for running during shutdown that writes to the database.
_elgg_invalidate_memcache_for_entity($entity_guid)
Invalidate an entity in memcache.
_elgg_get_memcache($namespace='default')
Get a namespaced ElggMemcache object (if memcache is available) or a null cache.
get_entity($guid)
Loads and returns an entity object from a guid.
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
getCurrentTime($modifier='')
Get the (cloned) time.
trait TimeUsing
Adds methods for setting the current time (for testing)
validate_email_address($address)
Simple validation of a email.
get_user_by_email($email)
Get an array of users from an email address.
validate_username($username)
Simple function which ensures that a username contains only valid characters.
get_user_by_username($username)
Get user by username.
validate_password($password)
Simple validation of a password.