Is there any reason why a custom greeting using smarty wouldn't work anymore on recent versions of CiviCRM:

{if "{contact.gender}"=="Femme"}Chère{ }{contact.first_name}{elseif "{contact.gender}"=="Homme"}Cher{ }{contact.first_name}{/if}

was working smoothly until recently on both WP and Drupal?

I don't understand what happened :-/

Of course Smarty is enabled :

if (!defined('CIVICRM_MAIL_SMARTY')) {   define( 'CIVICRM_MAIL_SMARTY', 1 ); }
  • 2
    I just tested it and it still works for us on 5.35.2 Drupal 7.x. Did you maybe change the values for {contact.gender}? Maybe you also want to include an else option such as this: {if "{contact.gender}"=="Femme"}Chère{ }{contact.first_name}{elseif "{contact.gender}"=="Homme"}Cher{ }{contact.first_name}{else}Hi there{/if}
    – Fabian
    Jun 9 '21 at 13:01
  • thanks Fabian, I'll try this way. Jun 10 '21 at 13:12

Gender wasn't properly define and @Fabian inspired me this little improvement:

{if "{contact.gender}"=="Femme"}Chère{ }{contact.first_name}{elseif "{contact.gender}"=="Homme"}Cher{ }{contact.first_name}{else}{contact.first_name}{/if}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.