40 parent::initializeAttributes();
42 $this->attributes[
'type'] =
'user';
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;
66 public function getLanguage(
string $fallback = null): string {
71 if ($fallback !== null) {
87 _elgg_services()->logger->error(
"User entities no longer contain {$name}");
90 _elgg_services()->logger->error(
'password_hash is a readonly attribute.');
107 if ($existing_user instanceof \
ElggUser && ($existing_user->guid !== $this->guid)) {
127 public function ban(
string $reason =
''): bool {
137 $this->ban_reason = $reason;
160 unset($this->ban_reason);
174 return $this->banned ===
'yes';
183 return $this->admin ===
'yes';
197 if (!
_elgg_services()->events->trigger(
'make_admin',
'user', $this)) {
219 if (!
_elgg_services()->events->trigger(
'remove_admin',
'user', $this)) {
238 if ($this->last_login ==
$time) {
246 $this->last_login =
$time;
259 if ($this->last_action ==
$time) {
280 if (!isset($this->validated)) {
284 return (
bool) $this->validated;
301 $this->validated = $status;
304 $this->validated_method = $method;
305 $this->validated_ts = time();
313 _elgg_services()->events->triggerAfter(
'validate',
'user', $this);
316 unset($this->validated_ts);
317 unset($this->validated_method);
318 _elgg_services()->events->triggerAfter(
'invalidate',
'user', $this);
331 $options[
'relationship'] =
'member';
367 $object = parent::prepareObject($object);
371 unset($object->read_access);
407 $this->{
"notification:{$purpose}:{$method}"} = (int) $enabled;
408 return $this->
save();
434 if (
$purpose !==
'default' && !isset($this->{
"notification:{$purpose}:{$method}"})) {
436 $settings[$method] = (bool) $this->{
"notification:default:{$method}"};
438 $settings[$method] = (bool) $this->{
"notification:{$purpose}:{$method}"};
449 $result = parent::persistentDelete($recursive);
452 _elgg_services()->users_remember_me_cookies_table->deleteAllHashes($this);
471 $static_defaults = (array)
$plugin->getStaticConfig(
'user_settings', []);
476 return $this->psGetPluginSetting($plugin_id, $name,
$default);
elgg_register_event_handler(string $event, string $type, callable|string $callback, int $priority=500)
Helper functions for event handling.
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags...
const ELGG_DISABLE_SYSTEM_LOG
setValidationStatus(bool $status, string $method= '')
Set the validation status for a user.
makeAdmin()
Make the user an admin.
getPluginSetting(string $plugin_id, string $name, $default=null)
Get a plugin setting.
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
Elgg registration action.
Plugin class containing helper functions for plugin activation/deactivation, dependency checking capa...
if(!$user||!$user->canDelete()) $name
trait ProfileData
Adds methods to save profile data to an ElggEntity.
invalidateCache()
Invalidate cache for entity.
elgg_get_user_by_username(string $username, bool $try_email=false)
Get a user by username.
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
enable(bool $recursive=true)
Enable the entity.
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)
{}
$plugin_id
Remove all user and plugin settings from the give plugin ID.
canEdit(int $user_guid=0)
Can a user edit this entity?
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
getCurrentTime($modifier= '')
Get the (cloned) time.
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
const ELGG_IGNORE_ACCESS
elgg_call() flags
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.
getLanguage(string $fallback=null)
Get user language or default to site language.
setMetadata(string $name, mixed $value, string $value_type= '', bool $multiple=false)
Set metadata on this entity.
getOwnerGUID()
Get a user's owner GUID.
isEnabled()
Is this entity enabled?
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
ban(string $reason= '')
Ban this user.
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.
setPassword(string $password)
Set the necessary metadata to store a hash of the user's password.
removeAdmin()
Remove the admin flag for user.
_elgg_services()
Get the global service provider.
isBanned()
Is this user banned or not?
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
persistentDelete(bool $recursive=true)
{}
getDisplayName()
Get the entity's display name.
$guid
Reset an ElggUpgrade.
Bundled plugins(the contents of the"/mod"directory) are available only under the GPLv2 license.The remainder of the project is available under either MIT or GPLv2.Both licenses can be found below.More info and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term"modification".) Each licensee is addressed as"you".Activities other than copying