diff --git a/core/modules/user/config/user.mail.yml b/core/modules/user/config/user.mail.yml index ea33738..a859f1e 100644 --- a/core/modules/user/config/user.mail.yml +++ b/core/modules/user/config/user.mail.yml @@ -5,10 +5,10 @@ password_reset: body: "[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password. It expires after one day and nothing will happen if it's not used.\n\n-- [site:name] team" subject: 'Replacement login information for [user:name] at [site:name]' register_admin_created: - body: "[user:name],\n\nA site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team" + body: "[user:name],\n\nA site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name-raw]\npassword: Your password\n\n-- [site:name] team" subject: 'An administrator created an account for you at [site:name]' register_no_approval_required: - body: "[user:name],\n\nThank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team" + body: "[user:name],\n\nThank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name-raw]\npassword: Your password\n\n-- [site:name] team" subject: 'Account details for [user:name] at [site:name]' register_pending_approval: body: "[user:name],\n\nThank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another e-mail containing information about how to log in, set your password, and other details.\n\n\n-- [site:name] team" @@ -17,7 +17,7 @@ register_pending_approval_admin: body: "[user:name] has applied for an account.\n\n[user:edit-url]" subject: 'Account details for [user:name] at [site:name] (pending admin approval)' status_activated: - body: "[user:name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team" + body: "[user:name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name-raw]\npassword: Your password\n\n-- [site:name] team" subject: 'Account details for [user:name] at [site:name] (approved)' status_blocked: body: "[user:name],\n\nYour account on [site:name] has been blocked.\n\n-- [site:name] team" diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc index 5412a38..a802ffa 100644 --- a/core/modules/user/user.tokens.inc +++ b/core/modules/user/user.tokens.inc @@ -26,6 +26,10 @@ function user_token_info() { ); $user['name'] = array( 'name' => t("Name"), + 'description' => t("The display name of the user account."), + ); + $user['name-raw'] = array( + 'name' => t("Name"), 'description' => t("The login name of the user account."), ); $user['mail'] = array( @@ -91,6 +95,11 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr $replacements[$original] = $sanitize ? check_plain($name) : $name; break; + case 'name-raw': + $name = $account->get('name')->value ?: \Drupal::config('user.settings')->get('anonymous'); + $replacements[$original] = $sanitize ? check_plain($name) : $name; + break; + case 'mail': $replacements[$original] = $sanitize ? check_plain($account->getEmail()) : $account->getEmail(); break;