You are here

function _hybridauth_mail_text in HybridAuth Social Login 7.2

Same name and namespace in other branches
  1. 7 hybridauth.module \_hybridauth_mail_text()

Returns a mail string for a variable name.

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

2 calls to _hybridauth_mail_text()
hybridauth_admin_settings in ./hybridauth.admin.inc
Form constructor for the hybridauth admin settings form.
hybridauth_mail in ./hybridauth.module
Implements hook_mail().

File

./hybridauth.module, line 1111
Main file for the HybridAuth module.

Code

function _hybridauth_mail_text($key, $language = NULL, $variables = array(), $replace = TRUE) {
  $langcode = isset($language) ? $language->language : NULL;
  $text = '';
  if ($admin_setting = variable_get($key, FALSE)) {

    // An admin setting overrides the default string.
    $text = $admin_setting;
  }
  else {

    // No override, return default string.
    switch ($key) {
      case 'hybridauth_email_verification_subject':
        $text = t('Account details for [user:name] at [site:name]', array(), array(
          'langcode' => $langcode,
        ));
        break;
      case 'hybridauth_email_verification_body':
        $text = t("[user:name],\n\nThank you for registering at [site:name]. You need to confirm your e-mail address 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 activate your account.\n\nAfter that, you will be able to log in at [site:login-url] using your [user:hybridauth:provider] account.\n\n--  [site:name] team", array(), array(
          'langcode' => $langcode,
        ));
        break;
    }
  }
  if ($replace) {

    // We do not sanitize the token replacement, since the output of this
    // replacement is intended for an e-mail message, not a web browser.
    return token_replace($text, $variables, array(
      'language' => $language,
      'callback' => 'user_mail_tokens',
      'sanitize' => FALSE,
      'clear' => TRUE,
    ));
  }
  return $text;
}