You are here

function _simplenews_subscription_confirmation_text in Simplenews 6

Same name and namespace in other branches
  1. 6.2 simplenews.module \_simplenews_subscription_confirmation_text()

Generate default and custom subscription confirmation email text.

Parameters

string $key text identification key:

object $language language object:

array $variables array of variables as used by t():

2 calls to _simplenews_subscription_confirmation_text()
simplenews_admin_settings_subscription in ./simplenews.admin.inc
Menu callback: Simplenews admin settings - Subscription.
simplenews_mail in ./simplenews.module
Implementation of hook_mail().

File

./simplenews.module, line 2363
Simplnews node handling, sent email, newsletter block and general hooks

Code

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

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

    // No override, return default string.
    switch ($key) {
      case 'subscribe_unsubscribed':
        return t("We have received a request for subscription of !mailto to the !newsletter_name on !site website at !uri. To confirm this subscription please use the link below.\n\n!confirm_subscribe_url", $variables, $langcode);
      case 'subscribe_subscribed':
        return t("We have received a request for subscription of !mailto to the !newsletter_name on !site website at !uri. However, this email is already subscribed to this newsletter. If you intended to unsubscribe please visit our site: !uri", $variables, $langcode);
      case 'unsubscribe_subscribed':
        return t("We have received a request to unsubscribe !mailto from the !newsletter_name on !site website at !uri. To confirm this unsubscription please use the link below.\n\n!confirm_unsubscribe_url", $variables, $langcode);
      case 'unsubscribe_unsubscribed':
        return t("We have received a request to unsubscribe !mailto from the !newsletter_name on !site website at !uri. However, this email is not subscribed to this newsletter. If you intended to subscribe please visit our site: !uri", $variables, $langcode);
      case 'subscribe_subject':
        return t("Confirmation for !newsletter_name from !site", $variables, $langcode);
    }
  }
}