2

I have written a custom Token which contains several standard paragraphs on how to make membership payments to our organisation, which will be included in several Message Templates related to email and PDF renewal reminders. This works OK for text and HTML, but gives errors if I try to include a CiviCRM Token within it (e.g. the Contact Id, which we are using as a membership number).

Presumably this is because SMARTY is processing the embedded token while carrying out the insert process, and does not have the necessary context on Contact details or related Tokens. I note that one contributor to question How can I include a custom template file in an email template using smarty? indicates that this may be a problem, but I wonder if there is any way round the problem?

1 Answer 1

0

Token replacements are done only once based on whats present in the html or text mail content. There won't be second round of token replacements once its replaced. In your case i guess you want to do the token replacement twice. After the token replacement is done the content is processed using smarty.

You will need to create the custom token values by replacing the tokens and passing the raw value.

1
  • I dont really understand how the CiviCRM token replacement relates to the SMARTY processing of e.g. conditional functions like {if}. In this case SMARTY is giving an error saying that the CiviCRM token which is being inserted is an unknown operation. Presumably something is happening in the wrong order. I dont want to process things twice, but to find a way to get them to happen in the right order.
    – user6274
    Commented Nov 17, 2021 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.