User::getRoleStorage

protected User::getRoleStorage() Returns the role storage object. Return value \Drupal\user\RoleStorageInterface The role storage object. File core/modules/user/src/Entity/User.php, line 546 Class User Defines the user entity class. Namespace Drupal\user\Entity Code protected function getRoleStorage() { return \Drupal::entityManager()->getStorage('user_role'); }

User::getTimeZone

public User::getTimeZone() Returns the timezone of this account. Return value string Name of the timezone. Overrides AccountInterface::getTimeZone File core/modules/user/src/Entity/User.php, line 304 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function getTimeZone() { return $this->get('timezone')->value; }

User::getUsername

public User::getUsername() Returns the unaltered login name of this account. Return value string An unsanitized plain-text string with the name of this account that is used to log in. Only display this name to admins and to the user who owns this account, and only in the context of the name used to log in. For any other display purposes, use \Drupal\Core\Session\AccountInterface::getDisplayName() instead. Overrides AccountInterface::getUsername Deprecated in Drupal 8.0.0, will be removed bef

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

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