user_pass_reset_url

user_pass_reset_url($account, $options = array()) Generates a unique URL for a user to log in and reset their password. Parameters \Drupal\user\UserInterface $account: An object containing the user account. array $options: (optional) A keyed array of settings. Supported options are: langcode: A language code to be used when generating locale-sensitive URLs. If langcode is NULL the users preferred language is used. Return value string A unique URL that provides a one-time log in for the use

user_pass_rehash

user_pass_rehash(UserInterface $account, $timestamp) Creates a unique hash value for use in time-dependent per-user URLs. This hash is normally used to build a unique and secure URL that is sent to the user by email for purposes such as resetting the user's password. In order to validate the URL, the same hash can be generated again, from the same information, and compared to the hash value from the URL. The hash contains the time stamp, the user's last login time, the numeric user ID, and the

user_password

user_password($length = 10) Generate a random alphanumeric password. File core/modules/user/user.module, line 281 Enables the user registration and login system. Code function user_password($length = 10) { // This variable contains the list of allowable characters for the // password. Note that the number 0 and the letter 'O' have been // removed to avoid confusion between the two. The same is true // of 'I', 1, and 'l'. $allowable_characters = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLM

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); }

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