Same name and namespace in other branches
  1. 4.6.x modules/user.module \_user_mail_text()
  2. 4.7.x modules/user.module \_user_mail_text()
  3. 5.x modules/user/user.module \_user_mail_text()
  4. 7.x modules/user/user.module \_user_mail_text()

Returns a mail string for a variable name.

Used by user_mail() and the settings forms to retrieve strings.

2 calls to _user_mail_text()
user_admin_settings in modules/user/user.admin.inc
Form builder; Configure user settings for this site.
user_mail in modules/user/user.module
Implementation of hook_mail().

File

modules/user/user.module, line 1734
Enables the user registration and login system.

Code

function _user_mail_text($key, $language = NULL, $variables = array()) {
  $langcode = isset($language) ? $language->language : NULL;
  if ($admin_setting = variable_get('user_mail_' . $key, FALSE)) {

    // An admin setting overrides the default string.
    return strtr($admin_setting, $variables);
  }
  else {

    // No override, return default string.
    switch ($key) {
      case 'register_no_approval_required_subject':
        return t('Account details for !username at !site', $variables, $langcode);
      case 'register_no_approval_required_body':
        return t("!username,\n\nThank you for registering at !site. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n--  !site team", $variables, $langcode);
      case 'register_admin_created_subject':
        return t('An administrator created an account for you at !site', $variables, $langcode);
      case 'register_admin_created_body':
        return t("!username,\n\nA site administrator at !site has created an account for you. You may now log in to !login_uri using the following username and password:\n\nusername: !username\npassword: !password\n\nYou may also log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\n\n--  !site team", $variables, $langcode);
      case 'register_pending_approval_subject':
      case 'register_pending_approval_admin_subject':
        return t('Account details for !username at !site (pending admin approval)', $variables, $langcode);
      case 'register_pending_approval_body':
        return t("!username,\n\nThank you for registering at !site. 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 team", $variables, $langcode);
      case 'register_pending_approval_admin_body':
        return t("!username has applied for an account.\n\n!edit_uri", $variables, $langcode);
      case 'password_reset_subject':
        return t('Replacement login information for !username at !site', $variables, $langcode);
      case 'password_reset_body':
        return t("!username,\n\nA request to reset the password for your account has been made at !site.\n\nYou may now log in to !uri_brief by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.", $variables, $langcode);
      case 'status_activated_subject':
        return t('Account details for !username at !site (approved)', $variables, $langcode);
      case 'status_activated_body':
        return t("!username,\n\nYour account at !site has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\nOnce you have set your own password, you will be able to log in to !login_uri in the future using:\n\nusername: !username\n", $variables, $langcode);
      case 'status_blocked_subject':
        return t('Account details for !username at !site (blocked)', $variables, $langcode);
      case 'status_blocked_body':
        return t("!username,\n\nYour account on !site has been blocked.", $variables, $langcode);
      case 'status_deleted_subject':
        return t('Account details for !username at !site (deleted)', $variables, $langcode);
      case 'status_deleted_body':
        return t("!username,\n\nYour account on !site has been deleted.", $variables, $langcode);
    }
  }
}