42 parent::initializeAttributes();
43 $this->attributes[
'subtype'] =
'user';
46 $this->attributes[
'owner_guid'] = 0;
47 $this->attributes[
'container_guid'] = 0;
53 $this->prev_last_action = 0;
54 $this->last_login = 0;
55 $this->prev_last_login = 0;
77 if ($fallback !== null) {
90 _elgg_services()->logger->error(
"User entities no longer contain {$name}");
93 _elgg_services()->logger->error(
"password_hash is a readonly attribute.");
109 if ($existing_user && ($existing_user->guid !== $this->guid)) {
129 public function ban($reason =
'') {
139 $this->ban_reason = $reason;
162 unset($this->ban_reason);
176 return $this->banned ===
'yes';
185 return $this->admin ===
'yes';
199 if (!
_elgg_services()->events->trigger(
'make_admin',
'user', $this)) {
221 if (!
_elgg_services()->events->trigger(
'remove_admin',
'user', $this)) {
241 if ($this->last_login ==
$time) {
248 $this->last_login =
$time;
260 if ($this->last_action ==
$time) {
281 if (!isset($this->validated)) {
284 return (
bool) $this->validated;
300 $this->validated = $status;
303 $this->validated_method = $method;
304 $this->validated_ts = time();
312 _elgg_services()->events->triggerAfter(
'validate',
'user', $this);
315 unset($this->validated_ts);
316 unset($this->validated_method);
317 _elgg_services()->events->triggerAfter(
'invalidate',
'user', $this);
330 $options[
'relationship'] =
'member';
354 if ($this->owner_guid == 0) {
365 $object = parent::prepareObject($object);
369 unset($object->read_access);
399 $this->{
"notification:{$purpose}:{$method}"} = (int)
$enabled;
400 return $this->
save();
426 if (
$purpose !==
'default' && !isset($this->{
"notification:{$purpose}:{$method}"})) {
428 $settings[$method] = (bool) $this->{
"notification:default:{$method}"};
430 $settings[$method] = (bool) $this->{
"notification:{$purpose}:{$method}"};
441 public function delete($recursive =
true) {
442 $result = parent::delete($recursive);
445 _elgg_services()->users_remember_me_cookies_table->deleteAllHashes($this);
468 ],
$value,
"Please user the plugin hook 'plugin_settings', '{$this->getType()}'",
'4.0');
470 return $this->psSetPluginSetting($plugin_id, $name, $value);
486 $static_defaults = (array)
$plugin->getStaticConfig(
'user_settings', []);
enable($recursive=true)
Enable the entity.
setValidationStatus(bool $status, string $method= '')
Set the validation status for a user.
getLanguage($fallback=null)
Get user language or default to site language.
if(!$user||!$user->canDelete()) $name
makeAdmin()
Make the user an admin.
getPluginSetting(string $plugin_id, string $name, $default=null)
Get a plugin setting.
Elgg registration action.
setPassword($password)
Set the necessary metadata to store a hash of the user's password.
trait ProfileData
Adds methods to save profile data to an ElggEntity.
invalidateCache()
Invalidate cache for entity.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
if(!$annotation instanceof ElggAnnotation) $time
setLastLogin()
Sets the last logon time of the user to right now.
Could not register a new user for whatever reason.
prepareObject(\Elgg\Export\Entity $object)
{}
canEdit($user_guid=0)
Can a user edit this entity?
$plugin_id
Remove all user and plugin settings from the give plugin ID.
get_user_by_username($username)
Get user by username.
getCurrentTime($modifier= '')
Get the (cloned) time.
getObjects(array $options=[])
{}
if(!$user||!$user->canEdit()) $password
setLastAction()
Sets the last action time of the given user to right now.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
$enabled
Sample cli installer script.
setPluginSetting(string $plugin_id, string $name, $value)
Save a plugin setting.
ban($reason= '')
Ban this user.
getOwnerGUID()
Get a user's owner GUID.
isEnabled()
Is this entity enabled?
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
setMetadata($name, $value, $value_type= '', $multiple=false)
Set metadata on this entity.
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
getGroups(array $options=[])
Gets the user's groups.
setNotificationSetting(string $method, bool $enabled=true, string $purpose= 'default')
Enable or disable a notification delivery method.
if($email instanceof\Elgg\Email) $object
getNotificationSettings(string $purpose= 'default')
Returns users's notification settings [ 'email' => true, // enabled 'ajax' => false, // disabled ]
isAdmin()
Is this user admin?
isValidated()
Gets the validation status of a user.
removeAdmin()
Remove the admin flag for user.
_elgg_services()
Get the global service provider.
isBanned()
Is this user banned or not?
getDisplayName()
Get the entity's display name.
elgg_get_config($name, $default=null)
Get an Elgg configuration value.
$guid
Reset an ElggUpgrade.
getPluginSetting as psGetPluginSetting