user_js_settings_alter

user_js_settings_alter(&$settings, AttachedAssetsInterface $assets) Implements hook_js_settings_alter(). File core/modules/user/user.module, line 111 Enables the user registration and login system. Code function user_js_settings_alter(&$settings, AttachedAssetsInterface $assets) { // Provide the user ID in drupalSettings to allow JavaScript code to customize // the experience for the end user, rather than the server side, which would // break the render cache. // Similarly, pr

user_load

user_load($uid, $reset = FALSE) Loads a user object. Parameters int $uid: Integer specifying the user ID to load. bool $reset: TRUE to reset the internal cache and load from the database; FALSE (default) to load from the internal cache, if set. Return value \Drupal\user\UserInterface A fully-loaded user object upon successful user load, or NULL if the user cannot be loaded. Deprecated in Drupal 8.x, will be removed before Drupal 9.0. Use \Drupal\user\Entity\User::load(). See also \Drupal\

user_load_by_mail

user_load_by_mail($mail) Fetches a user object by email address. Parameters string $mail: String with the account's email address. Return value object|bool A fully-loaded $user object upon successful user load or FALSE if user cannot be loaded. See also \Drupal\user\Entity\User::loadMultiple() File core/modules/user/user.module, line 234 Enables the user registration and login system. Code function user_load_by_mail($mail) { $users = \Drupal::entityTypeManager()->getStorage('user')

user_load_by_name

user_load_by_name($name) Fetches a user object by account name. Parameters string $name: String with the account's user name. Return value object|bool A fully-loaded $user object upon successful user load or FALSE if user cannot be loaded. See also \Drupal\user\Entity\User::loadMultiple() File core/modules/user/user.module, line 251 Enables the user registration and login system. Code function user_load_by_name($name) { $users = \Drupal::entityTypeManager()->getStorage('user') -&g

user_load_multiple

user_load_multiple(array $uids = NULL, $reset = FALSE) Loads multiple users based on certain conditions. This function should be used whenever you need to load more than one user from the database. Users are loaded into memory and will not require database access if loaded again during the same page request. Parameters array $uids: (optional) An array of entity IDs. If omitted, all entities are loaded. bool $reset: A boolean indicating that the internal cache should be reset. Use this if loadi

user_login_finalize

user_login_finalize(UserInterface $account) Finalizes the login process and logs in a user. The function logs in the user, records a watchdog message about the new session, saves the login timestamp, calls hook_user_login(), and generates a new session. The current user is replaced with the passed in account. Parameters \Drupal\user\UserInterface $account: The account to log in. See also hook_user_login() File core/modules/user/user.module, line 530 Enables the user registration and login sys

user_logout

user_logout() Logs the current user out. File core/modules/user/user.module, line 1391 Enables the user registration and login system. Code function user_logout() { $user = \Drupal::currentUser(); \Drupal::logger('user')->notice('Session closed for %name.', array('%name' => $user->getAccountName())); \Drupal::moduleHandler()->invokeAll('user_logout', array($user)); // Destroy the current session, and reset $user to the anonymous user. // Note: In Symfony the session i

user_mail

user_mail($key, &$message, $params) Implements hook_mail(). File core/modules/user/user.module, line 910 Enables the user registration and login system. Code function user_mail($key, &$message, $params) { $token_service = \Drupal::token(); $language_manager = \Drupal::languageManager(); $langcode = $message['langcode']; $variables = array('user' => $params['account']); $language = \Drupal::languageManager()->getLanguage($params['account']->getPreferredLangcode());

user_mail_tokens

user_mail_tokens(&$replacements, $data, $options) Token callback to add unsafe tokens for user mails. This function is used by \Drupal\Core\Utility\Token::replace() to set up some additional tokens that can be used in email messages generated by user_mail(). Parameters array $replacements: An associative array variable containing mappings from token names to values (for use with strtr()). array $data: An associative array of token replacement values. If the 'user' element exists, it must c

user_modules_uninstalled

user_modules_uninstalled($modules) Implements hook_modules_uninstalled(). File core/modules/user/user.module, line 1276 Enables the user registration and login system. Code function user_modules_uninstalled($modules) { // Remove any potentially orphan module data stored for users. \Drupal::service('user.data')->delete($modules); }