_user_mail_text

Versions
4.6 – 5
_user_mail_text($messageid, $variables = array())
6 – 7
_user_mail_text($key, $language = NULL, $variables = array())

Returns a mail string for a variable name.

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

▾ 2 functions call _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
Implement hook_mail().

Code

modules/user/user.module, line 2155

<?php
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.
    $text = $admin_setting;
  }
  else {
    // No override, return default string.
    switch ($key) {
      case 'register_no_approval_required_subject':
        $text = t('Account details for [user:name] at [site:name]', array(), array('langcode' => $langcode));
        break;
      case 'register_no_approval_required_body':
        $text = t("[user:name],

Thank you for registering at [site:name]. You may now log in to [site:login-url] using the following username and password:

username: [user:name]
password: [user:password]

You may also log in by clicking on this link or copying and pasting it in your browser:

[user:one-time-login-url]

This is a one-time login, so it can be used only once.

After logging in, you will be redirected to [user:edit-url] so you can change your password.


--  [site:name] team", array(), array('langcode' => $langcode));
        break;

      case 'register_admin_created_subject':
        $text = t('An administrator created an account for you at [site:name]', array(), array('langcode' => $langcode));
        break;
      case 'register_admin_created_body':
        $text = t("[user:name],

A site administrator at [site:name] has created an account for you. You may now log in to [site:login-url] using the following username and password:

username: [user:name]
password: [user:password]

You may also log in by clicking on this link or copying and pasting it in your browser:

[user:one-time-login-url]

This is a one-time login, so it can be used only once.

After logging in, you will be redirected to [user:edit-url] so you can change your password.


--  [site:name] team", array(), array('langcode' => $langcode));
        break;

      case 'register_pending_approval_subject':
      case 'register_pending_approval_admin_subject':
        $text = t('Account details for [user:name] at [site:name] (pending admin approval)', array(), array('langcode' => $langcode));
        break;
      case 'register_pending_approval_body':
        $text = t("[user:name],

Thank 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.


--  [site:name] team", array(), array('langcode' => $langcode));
        break;
      case 'register_pending_approval_admin_body':
        $text = t("[user:name] has applied for an account.

[user:edit-url]", array(), array('langcode' => $langcode));
        break;

      case 'password_reset_subject':
        $text = t('Replacement login information for [user:name] at [site:name]', array(), array('langcode' => $langcode));
        break;
      case 'password_reset_body':
        $text = t("[user:name],

A request to reset the password for your account has been made at [site:name].

You may now log in to [site:uri-brief] by clicking on this link or copying and pasting it in your browser:

[user:one-time-login-url]

This 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.

After logging in, you will be redirected to [user:edit-url] so you can change your password.", array(), array('langcode' => $langcode));
        break;

      case 'status_activated_subject':
        $text = t('Account details for [user:name] at [site:name] (approved)', array(), array('langcode' => $langcode));
        break;
      case 'status_activated_body':
        $text = t("[user:name],

Your account at [site:name] has been activated.

You may now log in by clicking on this link or copying and pasting it in your browser:

[site:login-url]

This is a one-time login, so it can be used only once.

After logging in, you will be redirected to [user:edit-url] so you can change your password.

Once you have set your own password, you will be able to log in to [site:login-url] in the future using:

username: [user:name]", array(), array('langcode' => $langcode));
        break;

      case 'status_blocked_subject':
        $text = t('Account details for [user:name] at [site:name] (blocked)', array(), array('langcode' => $langcode));
        break;
      case 'status_blocked_body':
        $text = t("[user:name],\n\nYour account on [site:name] has been blocked.", array(), array('langcode' => $langcode));
        break;

      case 'cancel_confirm_subject':
        $text = t('Account cancellation request for [user:name] at [site:name]', array(), array('langcode' => $langcode));
        break;
      case 'cancel_confirm_body':
        $text = t("[user:name],

A request to cancel your account has been made at [site:name].

You may now cancel your account on [site:url-brief] by clicking this link or copying and pasting it into your browser:

[user:cancel-url]

NOTE: The cancellation of your account is not reversible.

This link expires in one day and nothing will happen if it is not used.", array(), array('langcode' => $langcode));
        break;

      case 'status_canceled_subject':
        $text = t('Account details for [user:name] at [site:name] (canceled)', array(), array('langcode' => $langcode));
        break;
      case 'status_canceled_body':
        $text = t("[user:name],

Your account on [site:name] has been canceled.", array(), array('langcode' => $langcode));
        break;
    }
  }

  return token_replace($text, $variables, array('language' => $language, 'callback' => 'user_mail_tokens'));
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.