diff --git a/modules/user/user.module b/modules/user/user.module
index afb4119..a897c73 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -2509,7 +2509,7 @@ function _user_cancel($edit, $account, $method) {
_user_mail_notify('status_blocked', $account);
}
user_save($account, array('status' => 0));
- drupal_set_message(t('%name has been disabled.', array('%name' => $account->name)));
+ drupal_set_message(t('%name has been disabled.', array('%name' => format_username($account))));
watchdog('user', 'Blocked user: %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
break;
@@ -2519,8 +2519,12 @@ function _user_cancel($edit, $account, $method) {
if (!empty($edit['user_cancel_notify'])) {
_user_mail_notify('status_canceled', $account);
}
+
+ // Save username for further usage before deleting the account.
+ $username = format_username($account);
+
user_delete($account->uid);
- drupal_set_message(t('%name has been deleted.', array('%name' => $account->name)));
+ drupal_set_message(t('%name has been deleted.', array('%name' => $username)));
watchdog('user', 'Deleted user: %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
break;
}
@@ -3341,14 +3345,14 @@ function user_multiple_cancel_confirm($form, &$form_state) {
'#type' => 'hidden',
'#value' => $uid,
'#prefix' => '
',
- '#suffix' => check_plain($account->name) . "\n",
+ '#suffix' => check_plain(format_username($account)) . "\n",
);
}
// Output a notice that user 1 cannot be canceled.
if (isset($accounts[1])) {
$redirect = (count($accounts) == 1);
- $message = t('The user account %name cannot be cancelled.', array('%name' => $accounts[1]->name));
+ $message = t('The user account %name cannot be cancelled.', array('%name' => format_username($accounts[1])));
drupal_set_message($message, $redirect ? 'error' : 'warning');
// If only user 1 was selected, redirect to the overview.
if ($redirect) {
@@ -3928,7 +3932,7 @@ function user_register_submit($form, &$form_state) {
// New administrative account without notification.
$uri = entity_uri('user', $account);
if ($admin && !$notify) {
- drupal_set_message(t('Created a new user account for %name. No e-mail has been sent.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name)));
+ drupal_set_message(t('Created a new user account for %name. No e-mail has been sent.', array('@url' => url($uri['path'], $uri['options']), '%name' => format_username($account))));
}
// No e-mail verification required; log in user immediately.
elseif (!$admin && !variable_get('user_email_verification', TRUE) && $account->status) {
@@ -3943,7 +3947,7 @@ function user_register_submit($form, &$form_state) {
$op = $notify ? 'register_admin_created' : 'register_no_approval_required';
_user_mail_notify($op, $account);
if ($notify) {
- drupal_set_message(t('A welcome message with further instructions has been e-mailed to the new user %name.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name)));
+ drupal_set_message(t('A welcome message with further instructions has been e-mailed to the new user %name.', array('@url' => url($uri['path'], $uri['options']), '%name' => format_username($account))));
}
else {
drupal_set_message(t('A welcome message with further instructions has been sent to your e-mail address.'));
diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc
index 2d3c13d..456a980 100644
--- a/modules/user/user.pages.inc
+++ b/modules/user/user.pages.inc
@@ -98,14 +98,15 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
if ($user->uid) {
// The existing user is already logged in.
if ($user->uid == $uid) {
- drupal_set_message(t('You are logged in as %user. Change your password.', array('%user' => $user->name, '!user_edit' => url("user/$user->uid/edit"))));
+ drupal_set_message(t('You are logged in as %user. Change your password.', array('%user' => format_username($user),
+ '!user_edit' => url("user/$user->uid/edit"))));
}
// A different user is already logged in on the computer.
else {
$reset_link_account = user_load($uid);
if (!empty($reset_link_account)) {
drupal_set_message(t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please logout and try using the link again.',
- array('%other_user' => $user->name, '%resetting_user' => $reset_link_account->name, '!logout' => url('user/logout'))), 'warning');
+ array('%other_user' => format_username($user), '%resetting_user' => format_username($reset_link_account), '!logout' => url('user/logout'))), 'warning');
} else {
// Invalid one-time link specifies an unknown user.
drupal_set_message(t('The one-time login link you clicked is invalid.'), 'error');
@@ -142,7 +143,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
drupal_goto('user/' . $user->uid . '/edit', array('query' => array('pass-reset-token' => $token)));
}
else {
- $form['message'] = array('#markup' => t('This is a one-time login for %user_name and will expire on %expiration_date.
Click on this button to log in to the site and change your password.
', array('%user_name' => $account->name, '%expiration_date' => format_date($timestamp + $timeout))));
+ $form['message'] = array('#markup' => t('This is a one-time login for %user_name and will expire on %expiration_date.
Click on this button to log in to the site and change your password.
', array('%user_name' => format_username($account), '%expiration_date' => format_date($timestamp + $timeout))));
$form['help'] = array('#markup' => '' . t('This login can be used only once.') . '
');
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
@@ -394,7 +395,7 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
$question = t('Are you sure you want to cancel your account?');
}
else {
- $question = t('Are you sure you want to cancel the account %name?', array('%name' => $account->name));
+ $question = t('Are you sure you want to cancel the account %name?', array('%name' => format_username($account)));
}
$description = '';
if ($can_select_method) {