function _simplenews_subscription_confirmation_text in Simplenews 6.2
Same name and namespace in other branches
- 6 simplenews.module \_simplenews_subscription_confirmation_text()
Generate default and custom subscription confirmation email text.
Parameters
string $key: Text identification key
object $langcode: Language code
boolean $translate: FALSE: force return value to be untranslated text.
Return value
Invitation text. Optionally translated.
See also
3 calls to _simplenews_subscription_confirmation_text()
- simplenews_admin_settings_subscription in includes/
simplenews.admin.inc - Menu callback: Simplenews admin settings - Subscription.
- simplenews_locale_refresh in ./
simplenews.module - Refresh translatable strings.
- simplenews_mail in ./
simplenews.module - Implementation of hook_mail().
File
- ./
simplenews.module, line 2277 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function _simplenews_subscription_confirmation_text($key, $langcode = NULL, $translate = TRUE) {
$text = variable_get('simplenews_confirm_' . $key, FALSE);
// If administrator did not change the text, the variable is empty.
// We get the default here.
if (!$text) {
$args = array();
switch ($key) {
case 'subscribe_unsubscribed':
$text = t("We have received a request to subscribe [simplenews-receiver-mail] to the [simplenews-newsletters-name] newsletter on [site-name] website at [site-url]. To confirm this subscription please use the link below.\n\n[simplenews-subscribe-url]", $args, $langcode);
break;
case 'subscribe_subscribed':
$text = t("We have received a request to subscribe [simplenews-receiver-mail] to the [simplenews-newsletters-name] newsletter on [site-name] website at [site-url]. However, this email is already subscribed to this newsletter. If you intended to unsubscribe please visit our site at:\n[site-url]", $args, $langcode);
break;
case 'unsubscribe_subscribed':
$text = t("We have received a request to unsubscribe [simplenews-receiver-mail] from the [simplenews-newsletters-name] on [site-name] website at [site-url]. To confirm this cancellation please use the link below.\n\n[simplenews-unsubscribe-url]", $args, $langcode);
break;
case 'unsubscribe_unsubscribed':
$text = t("We have received a request to unsubscribe [simplenews-receiver-mail] from the [simplenews-newsletters-name] on [site-name] website at [site-url]. However, this email is not subscribed to this newsletter. If you intended to subscribe please visit our site at:\n[site-url]", $args, $langcode);
break;
case 'subscribe_subject':
$text = t("Confirmation for [simplenews-newsletters-name] from [site-name]", $args, $langcode);
break;
}
}
// If this is a multilingual website we use i18nstrings module to translate the content.
if (variable_get('language_count', 1) > 1 && function_exists('i18nstrings') && $translate) {
$text = i18nstrings('simplenews:' . $key, $text, $langcode);
}
return $text;
}