Question

Like in the title. I have a problem with my own custom token implemented via hook_civicrm_tokens and also hook_civicrm_tokenValues. When I try to send an email manualy, the token appears correctly in the list and it also appers parsed in the mail that the client recevies, the same with message templates expect that it appears as not parsed like {mycat.token}. It puzzles me because other tokens are inserted correctly in any case.

The code I've implemented looks something like this

function modulname_civicrm_tokens(&$tokens){
    $tokens['mytoken'] = array('mytoken.something' => 'token name');
}
function modulename_civicrm_tokenValues(&$values, $contactIDs){
    // some fancy logic for extracting data
    foreach ($contactIDs as $cid){
        $values[$cid]['mytoken.something'] = 'some data from other function connected with cid';
    }
}

Sorry if I messed up the code block.

Have enyone encountered this thing? Any tips how to fix this?

Was it helpful?

Solution

Ok, I found out why this did not work. Somebody did a hack in a module that only used the template body from civicrm and send the message via mimemail so no wonder that it did not work .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top