Mercurial > hg > isophonics-drupal-site
diff core/modules/user/user.module @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | c2387f117808 |
children | af1871eacc83 |
line wrap: on
line diff
--- a/core/modules/user/user.module Tue Jul 10 15:07:59 2018 +0100 +++ b/core/modules/user/user.module Thu Feb 28 13:21:36 2019 +0000 @@ -491,9 +491,9 @@ // unsanitized version, in case other preprocess functions want to implement // their own shortening logic or add markup. If they do so, they must ensure // that $variables['name'] is safe for printing. - $name = $account->getDisplayName(); + $name = $account->getDisplayName(); $variables['name_raw'] = $account->getUsername(); - if (Unicode::strlen($name) > 20) { + if (mb_strlen($name) > 20) { $name = Unicode::truncate($name, 15, FALSE, TRUE); $variables['truncated'] = TRUE; } @@ -569,7 +569,7 @@ /** * Implements hook_user_login(). */ -function user_user_login($account) { +function user_user_login(UserInterface $account) { // Reset static cache of default variables in template_preprocess() to reflect // the new user. drupal_static_reset('template_preprocess'); @@ -578,7 +578,7 @@ /** * Implements hook_user_logout(). */ -function user_user_logout($account) { +function user_user_logout(AccountInterface $account) { // Reset static cache of default variables in template_preprocess() to reflect // the new user. drupal_static_reset('template_preprocess'); @@ -609,7 +609,7 @@ ], [ 'absolute' => TRUE, - 'language' => \Drupal::languageManager()->getLanguage($langcode) + 'language' => \Drupal::languageManager()->getLanguage($langcode), ] ); } @@ -638,7 +638,7 @@ return \Drupal::url('user.cancel_confirm', [ 'user' => $account->id(), 'timestamp' => $timestamp, - 'hashed_pass' => user_pass_rehash($account, $timestamp) + 'hashed_pass' => user_pass_rehash($account, $timestamp), ], $url_options); } @@ -690,7 +690,7 @@ $account = User::load($uid); if (!$account) { - drupal_set_message(t('The user account %id does not exist.', ['%id' => $uid]), 'error'); + \Drupal::messenger()->addError(t('The user account %id does not exist.', ['%id' => $uid])); \Drupal::logger('user')->error('Attempted to cancel non-existing user account: %id.', ['%id' => $uid]); return; } @@ -761,7 +761,7 @@ } $account->block(); $account->save(); - drupal_set_message(t('%name has been disabled.', ['%name' => $account->getDisplayName()])); + \Drupal::messenger()->addStatus(t('%name has been disabled.', ['%name' => $account->getDisplayName()])); $logger->notice('Blocked user: %name %email.', ['%name' => $account->getAccountName(), '%email' => '<' . $account->getEmail() . '>']); break; @@ -772,7 +772,7 @@ _user_mail_notify('status_canceled', $account); } $account->delete(); - drupal_set_message(t('%name has been deleted.', ['%name' => $account->getDisplayName()])); + \Drupal::messenger()->addStatus(t('%name has been deleted.', ['%name' => $account->getDisplayName()])); $logger->notice('Deleted user: %name %email.', ['%name' => $account->getAccountName(), '%email' => '<' . $account->getEmail() . '>']); break; }