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::isNew

public User::isNew() Determines whether the entity is new. Usually an entity is new if no ID exists for it yet. However, entities may be enforced to be new with existing IDs too. Return value bool TRUE if the entity is new, or FALSE if the entity has already been saved. Overrides Entity::isNew See also \Drupal\Core\Entity\EntityInterface::enforceIsNew() File core/modules/user/src/Entity/User.php, line 73 Class User Defines the user entity class. Namespace Drupal\user\Entity Code publ

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::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::isActive

public User::isActive() Returns TRUE if the user is active. Return value bool TRUE if the user is active, false otherwise. Overrides UserInterface::isActive File core/modules/user/src/Entity/User.php, line 274 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function isActive() { return $this->get('status')->value == 1; }

User::hasRole

public User::hasRole($rid) Whether a user has a certain role. Parameters string $rid: The role ID to check. Return value bool Returns TRUE if the user has the role, otherwise FALSE. Overrides UserInterface::hasRole File core/modules/user/src/Entity/User.php, line 167 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function hasRole($rid) { return in_array($rid, $this->getRoles()); }

User::isAnonymous

public User::isAnonymous() Returns TRUE if the account is anonymous. Return value bool TRUE if the account is anonymous. Overrides AccountInterface::isAnonymous File core/modules/user/src/Entity/User.php, line 352 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function isAnonymous() { return $this->id() == 0; }

User::isBlocked

public User::isBlocked() Returns TRUE if the user is blocked. Return value bool TRUE if the user is blocked, false otherwise. Overrides UserInterface::isBlocked File core/modules/user/src/Entity/User.php, line 281 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function isBlocked() { return $this->get('status')->value == 0; }

User::isAuthenticated

public User::isAuthenticated() Returns TRUE if the account is authenticated. Return value bool TRUE if the account is authenticated. Overrides AccountInterface::isAuthenticated File core/modules/user/src/Entity/User.php, line 346 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function isAuthenticated() { return $this->id() > 0; }

User::hasPermission

public User::hasPermission($permission) Checks whether a user has a certain permission. Parameters string $permission: The permission string to check. Return value bool TRUE if the user has the permission, FALSE otherwise. Overrides AccountInterface::hasPermission File core/modules/user/src/Entity/User.php, line 195 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function hasPermission($permission) { // User #1 has all privileges. if ((int) $thi