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::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::$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.views_execution.inc

Provide views runtime hooks for user.module. File core/modules/user/user.views_execution.inc Functions Name Description user_views_query_substitutions Implements hook_views_query_substitutions().

user.module

Enables the user registration and login system. File core/modules/user/user.module Functions Name Description template_preprocess_user Prepares variables for user templates. template_preprocess_username Prepares variables for username templates. user_cancel Cancel a user account. user_cancel_methods Helper function to return available account cancellation methods. user_cancel_url Generates a URL to confirm an account cancellation request. user_cookie_delete Delete

user.install

Install, update and uninstall functions for the user module. File core/modules/user/user.install Functions Name Description user_install Implements hook_install(). user_schema Implements hook_schema(). user_update_8100 Fix invalid token in the status_blocked email body.

user.html.twig

Default theme implementation to present all user data. This template is used when viewing a registered user's page, e.g., example.com/user/123. 123 being the user's ID. Available variables: content: A list of content items. Use 'content' to print all content, or print a subset such as 'content.field_example'. Fields attached to a user such as 'user_picture' are available as 'content.user_picture'. attributes: HTML attributes for the container element. user: A Drupal User entity. See also

User accounts, permissions, and roles

API for user accounts, access checking, roles, and permissions. Overview and terminology Drupal's permission system is based on the concepts of accounts, roles, and permissions. Users (site visitors) have accounts, which include a user name, an email address, a password (or some other means of authentication), and possibly other fields (if defined on the site). Anonymous users have an implicit account that does not have a real user name or any account information. Each user account is assigned

User

Defines the user entity class. The base table name here is plural, despite Drupal table naming standards, because "user" is a reserved word in many databases. Plugin annotation @ContentEntityType( id = "user", label = @Translation("User"), handlers = { "storage" = "Drupal\user\UserStorage", "storage_schema" = "Drupal\user\UserStorageSchema", "access" = "Drupal\user\UserAccessControlHandler", "list_builder" = "Drupal\user\UserListBuilder", "views_data" = "Drupal\user\Us

UseCacheBackendTrait::cacheSet

protected UseCacheBackendTrait::cacheSet($cid, $data, $expire = Cache::PERMANENT, array $tags = []) Stores data in the persistent cache, respecting the use caches flag. Parameters string $cid: The cache ID of the data to store. mixed $data: The data to store in the cache. Some storage engines only allow objects up to a maximum of 1MB in size to be stored by default. When caching large arrays or similar, take care to ensure $data does not exceed this size. int $expire: One of the following valu