Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.6
-
Fix Version/s: 4.7.2
-
Component/s: Core CiviCRM
-
Documentation Required?:None
-
Funding Source:Paid Issue Queue
-
Payment Status:Paid
Description
Custom tokens won't get replaced when used in greetings. Neither those with custom keys/categories nor those added to "contact" key.
keyname.tokenname shaped toekns won't get to replaceHookTokens() because only contact key is handled. And contact key's custom token's get escaped before replaceHookTokens() is called.
Line 1464 ff. say
if (!empty($remainingTokens['contact'])) { // Fill the return properties array $greetingTokens = $remainingTokens['contact']; reset($greetingTokens); $greetingsReturnProperties = array(); while (list($key) = each($greetingTokens)) { $props = array_flip(CRM_Utils_Array::value($key, $greetingTokens)); $props = array_fill_keys(array_keys($props), 1);
As from what I know about the tokens array structure this seems to result in faulty array handling. And for god's sake custom token's shouldn't be bound to »contact« category. So changing the first three lines of the above to
if (!empty($remainingTokens)) { // Fill the return properties array $greetingTokens = $remainingTokens;
allows handling of custom tokens in custom categories and fixes errors reported in http://civicrm.stackexchange.com/questions/2004/error-for-token-php-related-to-greeting-tokens?rq=1 Civi's SE.
Could someone review and comment on this plz.
Thanks for this cool peace of software!