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) {
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) {
221 $r =
_elgg_services()->db->updateData(
"UPDATE {$this->CONFIG->dbprefix}users_entity set admin='no' where guid=$user_guid");
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",
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'));
435 $user = new \ElggUser();
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}";
if($guid==elgg_get_logged_in_user_guid()) $name
if(! $autoload_available) _elgg_services()
$user_guid
Avatar remove action.
getRow($guid)
Return the user specific details of a user by a row.
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.
validateInviteCode($username, $code)
Validate a user's invite code.
setLastLogin($user_guid)
Sets the last logon time of the given user to right now.
unban($user_guid)
Unban a user.
getValidationStatus($user_guid)
Gets the validation status of a user.
setLastAction($user_guid)
Sets the last action time of the given user to right now.
ban($user_guid, $reason="")
Ban a user.
getByUsername($username)
Get user by username.
makeAdmin($user_guid)
Makes user $guid an admin.
__construct()
Constructor.
global $USERNAME_TO_GUID_MAP_CACHE
Map a username to a cached GUID.
$guid
Removes an admin notice.
events($event="", $object_type="", $function="", $priority=500, $call=false, $object=null)
Deprecated events core function.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends 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_get_access_where_sql(array $options=array())
Returns the SQL where clause for enforcing read access to data.
sanitise_string($string)
Wrapper function for alternate English spelling (.
execute_delayed_write_query($query, $handler="")
Queue a query for running during shutdown that writes to the database.
get_entity($guid)
Loads and returns an entity object from a guid.
_elgg_invalidate_cache_for_entity($guid)
Invalidate this class's entry in the cache.
_elgg_retrieve_cached_entity($guid)
Retrieve a entity from the cache.
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
is_memcache_available()
Return true if memcache is available and configured.
set_user_notification_setting($user_guid, $method, $value)
Set a user notification pref.
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.