User::postDelete

public static User::postDelete(EntityStorageInterface $storage, array $entities) Acts on deleted entities before the delete hook is invoked. Used after the entities are deleted but before invoking the delete hook. Parameters \Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object. \Drupal\Core\Entity\EntityInterface[] $entities: An array of entities. Overrides Entity::postDelete File core/modules/user/src/Entity/User.php, line 132 Class User Defines the user entity

User::postSave

public User::postSave(EntityStorageInterface $storage, $update = TRUE) Acts on a saved entity before the insert or update hook is invoked. Used after the entity is saved, but before invoking the insert or update hook. Note that in case of translatable content entities this callback is only fired on their current translation. It is up to the developer to iterate over all translations if needed. Parameters \Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object. bool $upda

User::preSave

public User::preSave(EntityStorageInterface $storage) Acts on an entity before the presave hook is invoked. Used before the entity is saved and before invoking the presave hook. Note that in case of translatable content entities this callback is only fired on their current translation. It is up to the developer to iterate over all translations if needed. This is different from its counterpart in the Field API, FieldItemListInterface::preSave(), which is fired on all field translations automatic

User::removeRole

public User::removeRole($rid) Remove a role from a user. Parameters string $rid: The role ID to remove. Overrides UserInterface::removeRole File core/modules/user/src/Entity/User.php, line 188 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function removeRole($rid) { $this->set('roles', array_diff($this->getRoles(TRUE), array($rid))); }

User::setEmail

public User::setEmail($mail) Sets the email address of the user. Parameters string $mail: The new email address of the user. Return value \Drupal\user\UserInterface The called user entity. Overrides UserInterface::setEmail File core/modules/user/src/Entity/User.php, line 229 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function setEmail($mail) { $this->get('mail')->value = $mail; return $this; }

User::setExistingPassword

public User::setExistingPassword($password) Sets the existing plain text password. Required for validation when changing the password, name or email fields. Parameters string $password: The existing plain text password of the user. Return value $this Overrides UserInterface::setExistingPassword File core/modules/user/src/Entity/User.php, line 390 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function setExistingPassword($password) { $this->ge

User::setLastAccessTime

public User::setLastAccessTime($timestamp) Sets the UNIX timestamp when the user last accessed the site.. Parameters int $timestamp: Timestamp of the last access. Return value \Drupal\user\UserInterface The called user entity. Overrides UserInterface::setLastAccessTime File core/modules/user/src/Entity/User.php, line 251 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function setLastAccessTime($timestamp) { $this->get('access')->value = $ti

User::setLastLoginTime

public User::setLastLoginTime($timestamp) Sets the UNIX timestamp when the user last logged in. Parameters int $timestamp: Timestamp of the last login time. Return value \Drupal\user\UserInterface The called user entity. Overrides UserInterface::setLastLoginTime File core/modules/user/src/Entity/User.php, line 266 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function setLastLoginTime($timestamp) { $this->get('login')->value = $timestamp;

User::setPassword

public User::setPassword($password) Sets the user password. Parameters string $password: The new unhashed password. Return value \Drupal\user\UserInterface The called user entity. Overrides UserInterface::setPassword File core/modules/user/src/Entity/User.php, line 214 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function setPassword($password) { $this->get('pass')->value = $password; return $this; }

User::setUsername

public User::setUsername($username) Sets the username of this account. Parameters string $username: The new user name. Return value \Drupal\user\UserInterface The called user entity. Overrides UserInterface::setUsername File core/modules/user/src/Entity/User.php, line 382 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function setUsername($username) { $this->set('name', $username); return $this; }