3

We have some custom event fields that were set up before our time and are set to apply to all types of events, even though they are rarely used anymore. However, when a registration is entered from the administration end of things, the receipt includes all of these fields so there is a long list of empty (and irrelevant) fields in the email that is sent.

What is the best way to hide those fields (ideally only if they are empty)?

3

It sounds like you want to edit your Smarty templates for your receipts and use the Smarty "capture" function:

From http://www.smarty.net/docs/en/language.function.capture.tpl: "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute."

You use "capture", then an "if" statement to check if the field is empty before displaying it. There are good examples on the page linked above.

  • Thanks -- I will put this on my list to try. I need to up my Smarty game. – Laryn - CEDC.org Apr 8 '15 at 21:41
3

If you want to remove them when they are empty you will have to create a customization using the CiviCRM hooks. If you want to remove them from the email and do not really care about the data in them, you could contemplate disabling the custom fields?

  • Disabling is potentially an option although I think they wanted to keep them around "just in case". – Laryn - CEDC.org Apr 8 '15 at 21:41
  • 1
    If you disable the data will still be there and you can always enable again? And if you find out you never use them you can delete after some time. – ErikH - CiviCooP Apr 9 '15 at 6:34

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.