$text = CRM_Utils_String::htmlToText($component->body_html);
}
- $html = CRM_Utils_Token::replaceWelcomeTokens($html, $group->title, TRUE);
- $text = CRM_Utils_Token::replaceWelcomeTokens($text, $group->title, FALSE);
+ $bao = new CRM_Mailing_BAO_Mailing();
+ $bao->body_text = $text;
+ $bao->body_html = $html;
+ $templates = $bao->getTemplates();
+
+ $html = CRM_Utils_Token::replaceWelcomeTokens($templates['html'], $group->title, TRUE);
+ $text = CRM_Utils_Token::replaceWelcomeTokens($templates['text'], $group->title, FALSE);
$tokenProcessor = new TokenProcessor(\Civi::dispatcher(), [
'controller' => __CLASS__,
$bao->body_text = $text;
$bao->body_html = $html;
$tokens = $bao->getTokens();
+ $templates = $bao->getTemplates();
+
if ($eq->format == 'HTML' || $eq->format == 'Both') {
- $html = CRM_Utils_Token::replaceResubscribeTokens($html, $domain, $groups, TRUE, $eq->contact_id, $eq->hash);
+ $html = CRM_Utils_Token::replaceResubscribeTokens($templates['html'], $domain, $groups, TRUE, $eq->contact_id, $eq->hash);
$html = CRM_Utils_Token::replaceActionTokens($html, $addresses, $urls, TRUE, $tokens['html']);
$html = CRM_Utils_Token::replaceMailingTokens($html, $dao, NULL, $tokens['html']);
}
if (!$html || $eq->format == 'Text' || $eq->format == 'Both') {
- $text = CRM_Utils_Token::replaceResubscribeTokens($text, $domain, $groups, FALSE, $eq->contact_id, $eq->hash);
+ $text = CRM_Utils_Token::replaceResubscribeTokens($templates['text'], $domain, $groups, FALSE, $eq->contact_id, $eq->hash);
$text = CRM_Utils_Token::replaceActionTokens($text, $addresses, $urls, FALSE, $tokens['text']);
$text = CRM_Utils_Token::replaceMailingTokens($text, $dao, NULL, $tokens['text']);
}
$text = CRM_Utils_String::htmlToText($component->body_html);
}
- $html = CRM_Utils_Token::replaceSubscribeTokens($html, $group->title, $url, TRUE);
- $text = CRM_Utils_Token::replaceSubscribeTokens($text, $group->title, $url, FALSE);
+ $bao = new CRM_Mailing_BAO_Mailing();
+ $bao->body_text = $text;
+ $bao->body_html = $html;
+ $templates = $bao->getTemplates();
+
+ $html = CRM_Utils_Token::replaceSubscribeTokens($templates['html'], $group->title, $url, TRUE);
+ $text = CRM_Utils_Token::replaceSubscribeTokens($templates['text'], $group->title, $url, FALSE);
// render the & entities in text mode, so that the links work
$text = str_replace('&', '&', $text);
$bao->body_text = $text;
$bao->body_html = $html;
$tokens = $bao->getTokens();
+ $templates = $bao->getTemplates();
+
if ($eq->format == 'HTML' || $eq->format == 'Both') {
- $html = CRM_Utils_Token::replaceUnsubscribeTokens($html, $domain, $groups, TRUE, $eq->contact_id, $eq->hash);
+ $html = CRM_Utils_Token::replaceUnsubscribeTokens($templates['html'], $domain, $groups, TRUE, $eq->contact_id, $eq->hash);
$html = CRM_Utils_Token::replaceActionTokens($html, $addresses, $urls, TRUE, $tokens['html']);
$html = CRM_Utils_Token::replaceMailingTokens($html, $dao, NULL, $tokens['html']);
}
if (!$html || $eq->format == 'Text' || $eq->format == 'Both') {
- $text = CRM_Utils_Token::replaceUnsubscribeTokens($text, $domain, $groups, FALSE, $eq->contact_id, $eq->hash);
+ $text = CRM_Utils_Token::replaceUnsubscribeTokens($templates['text'], $domain, $groups, FALSE, $eq->contact_id, $eq->hash);
$text = CRM_Utils_Token::replaceActionTokens($text, $addresses, $urls, FALSE, $tokens['text']);
$text = CRM_Utils_Token::replaceMailingTokens($text, $dao, NULL, $tokens['text']);
}