User::$anonymousUser

Stores a reference for a reusable anonymous user entity. Type: \Drupal\user\UserInterface File core/modules/user/src/Entity/User.php, line 68 Class User Defines the user entity class. Namespace Drupal\user\Entity Code protected static $anonymousUser;

User::activate

public User::activate() Activates the user. Return value \Drupal\user\UserInterface The called user entity. Overrides UserInterface::activate File core/modules/user/src/Entity/User.php, line 288 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function activate() { $this->get('status')->value = 1; return $this; }

User::addRole

public User::addRole($rid) Add a role to a user. Parameters string $rid: The role ID to add. Overrides UserInterface::addRole File core/modules/user/src/Entity/User.php, line 174 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function addRole($rid) { if (in_array($rid, [RoleInterface::AUTHENTICATED_ID, RoleInterface::ANONYMOUS_ID])) { throw new \InvalidArgumentException('Anonymous or authenticated role ID must not be assigned manually.'); }

User::baseFieldDefinitions

public static User::baseFieldDefinitions(EntityTypeInterface $entity_type) Provides base field definitions for an entity type. Implementations typically use the class \Drupal\Core\Field\BaseFieldDefinition for creating the field definitions; for example a 'name' field could be defined as the following: $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name')); By definition, base fields are fields that exist for every bundle. To provide definitions for fields that sho

User::block

public User::block() Blocks the user. Return value \Drupal\user\UserInterface The called user entity. Overrides UserInterface::block File core/modules/user/src/Entity/User.php, line 296 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public function block() { $this->get('status')->value = 0; return $this; }

User::checkExistingPassword

public User::checkExistingPassword(UserInterface $account_unchanged) Checks the existing password if set. Parameters \Drupal\user\UserInterface $account_unchanged: The unchanged user entity to compare against. Return value bool TRUE if the correct existing password was provided. Overrides UserInterface::checkExistingPassword See also UserInterface::setExistingPassword() File core/modules/user/src/Entity/User.php, line 397 Class User Defines the user entity class. Namespace Drupal\use

User::getAccountName

public User::getAccountName() 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 login. For any other display purposes, use \Drupal\Core\Session\AccountInterface::getDisplayName() instead. Overrides AccountInterface::getAccountName File core/modules/user/src/Entity/User.php,

User::getAllowedConfigurableLanguageCodes

public static User::getAllowedConfigurableLanguageCodes() Defines allowed configurable language codes for AllowedValues constraints. Return value string[] The allowed values. File core/modules/user/src/Entity/User.php, line 566 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public static function getAllowedConfigurableLanguageCodes() { return array_keys(\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_CONFIGURABLE)); }

User::getAllowedTimezones

public static User::getAllowedTimezones() Defines allowed timezones for the field's AllowedValues constraint. Return value string[] The allowed values. File core/modules/user/src/Entity/User.php, line 556 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public static function getAllowedTimezones() { return array_keys(system_time_zones()); }

User::getAnonymousUser

public static User::getAnonymousUser() Returns an anonymous user entity. Return value \Drupal\user\UserInterface An anonymous user entity. File core/modules/user/src/Entity/User.php, line 407 Class User Defines the user entity class. Namespace Drupal\user\Entity Code public static function getAnonymousUser() { if (!isset(static::$anonymousUser)) { // @todo Use the entity factory once available, see // https://www.drupal.org/node/1867228. $entity_manager = \Drupal::ent