From e66cb98f6d91f491b8b6831f87a4430dcc1e0cf8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 4 Sep 2015 12:27:40 -0700 Subject: [PATCH] CRM-17038, CRM-13422 - Tokens - Adjust greeting evaluation order Following f551f7d32, replaceGreetingTokens tramples other tokens, so it has to run at the end. --- Civi/Token/TokenCompatSubscriber.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Civi/Token/TokenCompatSubscriber.php b/Civi/Token/TokenCompatSubscriber.php index a0aa9bf689..152b5b7ae0 100644 --- a/Civi/Token/TokenCompatSubscriber.php +++ b/Civi/Token/TokenCompatSubscriber.php @@ -93,10 +93,6 @@ class TokenCompatSubscriber implements EventSubscriberInterface { $isHtml = ($e->message['format'] == 'text/html'); $useSmarty = !empty($e->context['smarty']); - if (!empty($e->context['contact'])) { - \CRM_Utils_Token::replaceGreetingTokens($e->string, NULL, $e->context['contact']['contact_id'], NULL, $useSmarty); - } - $e->string = \CRM_Utils_Token::replaceDomainTokens($e->string, \CRM_Core_BAO_Domain::getDomain(), $isHtml, $e->message['tokens'], $useSmarty); if (!empty($e->context['contact'])) { @@ -104,6 +100,8 @@ class TokenCompatSubscriber implements EventSubscriberInterface { // FIXME: This may depend on $contact being merged with hook values. $e->string = \CRM_Utils_Token::replaceHookTokens($e->string, $e->context['contact'], $e->context['hookTokenCategories'], $isHtml, $useSmarty); + + \CRM_Utils_Token::replaceGreetingTokens($e->string, NULL, $e->context['contact']['contact_id'], NULL, $useSmarty); } if ($useSmarty) { -- 2.25.1