user_role_names

user_role_names($membersonly = FALSE, $permission = NULL) Retrieves the names of roles matching specified conditions. Parameters bool $membersonly: (optional) Set this to TRUE to exclude the 'anonymous' role. Defaults to FALSE. string|null $permission: (optional) A string containing a permission. If set, only roles containing that permission are returned. Defaults to NULL, which returns all roles. Return value array An associative array with the role id as the key and the role name as value.

user_role_load

user_role_load($rid) Fetches a user role by role ID. Parameters string $rid: A string representing the role ID. Return value \Drupal\user\RoleInterface|null A fully-loaded role object if a role with the given ID exists, or NULL otherwise. Deprecated in Drupal 8.x, will be removed before Drupal 9.0. Use \Drupal\user\Entity\Role::load(). File core/modules/user/user.module, line 1081 Enables the user registration and login system. Code function user_role_load($rid) { return Role::load($ri

user_role_grant_permissions

user_role_grant_permissions($rid, array $permissions = array()) Grant permissions to a user role. Parameters mixed $rid: The ID of a user role to alter. array $permissions: (optional) A list of permission names to grant. See also user_role_change_permissions() user_role_revoke_permissions() File core/modules/user/user.module, line 1139 Enables the user registration and login system. Code function user_role_grant_permissions($rid, array $permissions = array()) { // Grant new permissions fo

user_role_change_permissions

user_role_change_permissions($rid, array $permissions = array()) Change permissions for a user role. This function may be used to grant and revoke multiple permissions at once. For example, when a form exposes checkboxes to configure permissions for a role, the form submit handler may directly pass the submitted values for the checkboxes form element to this function. Parameters mixed $rid: The ID of a user role to alter. array $permissions: (optional) An associative array, where the key holds

user_roles

user_roles($membersonly = FALSE, $permission = NULL) Retrieve an array of roles matching specified conditions. Parameters bool $membersonly: (optional) Set this to TRUE to exclude the 'anonymous' role. Defaults to FALSE. string|null $permission: (optional) A string containing a permission. If set, only roles containing that permission are returned. Defaults to NULL, which returns all roles. Return value \Drupal\user\RoleInterface[] An associative array with the role id as the key and the role

USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL

Visitors can create accounts, but they don't become active without administrative approval. File core/modules/user/user.module, line 48 Enables the user registration and login system. Code const USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL = 'visitors_admin_approval';

USER_REGISTER_VISITORS

Visitors can create their own accounts. File core/modules/user/user.module, line 42 Enables the user registration and login system. Code const USER_REGISTER_VISITORS = 'visitors';

USER_REGISTER_ADMINISTRATORS_ONLY

Only administrators can create user accounts. File core/modules/user/user.module, line 37 Enables the user registration and login system. Code const USER_REGISTER_ADMINISTRATORS_ONLY = 'admin_only';

user_preprocess_block

user_preprocess_block(&$variables) Implements hook_preprocess_HOOK() for block templates. File core/modules/user/user.module, line 401 Enables the user registration and login system. Code function user_preprocess_block(&$variables) { if ($variables['configuration']['provider'] == 'user') { switch ($variables['elements']['#plugin_id']) { case 'user_login_block': $variables['attributes']['role'] = 'form'; break; } } }

user_picture_enabled

user_picture_enabled() Returns whether this site supports the default user picture feature. This approach preserves compatibility with node/comment templates. Alternate user picture implementations (e.g., Gravatar) should provide their own add/edit/delete forms and populate the 'picture' variable during the preprocess stage. File core/modules/user/user.module, line 130 Enables the user registration and login system. Code function user_picture_enabled() { $field_definitions = \Drupal::entity