3

I would like to display some data attached to an event registrant on the Thank-you page. Is there a way to enable Token parsing on the Thank-you Title, Introductory Text, and Footer Text?

Example:

Hey there {contact.first_name}, thanks for registering for this event!

1 Answer 1

2

Not quite in the way you'd like, unfortunately. In time, this will be possible with Form Builder, but not yet.

For now, you have a few options. I won't go into details, but will answer follow-up questions if other Stack Exchange questions/online docs don't help.

First - the simplest solution might be to redirect to a different page of your choosing. If you have another page that you can configure with their info (e.g. a Drupal View), use the Front End Page Options extension.

The second-simplest answer is to modify the thank-you template. This isn't ideal because your thank-you page will be stuck on the current version of CiviCRM unless you manually redo your changes on each upgrade. I only recommend this because it takes the least tech knowledge (though still quite a bit!).

  • Define a custom template directory at Administer » System Settings » Resource URLs and Administer » System Settings » Directories.
  • In that folder, make the following folder hierarchy: CRM/Event/Form/Registration.
  • Find that same folder relative to your CiviCRM root folder (in modules on Drupal/Backdrop, plugins on WP) and copy ThankYou.tpl to the equivalent location in your custom templates folder.
  • You can now modify the (new) .tpl file to add text/tokens. You'll see a bunch of tokens in the file, but these aren't the "normal" tokens, which aren't available here. You can see all available tokens by adding the {debug} token to the page.

Note that if you're comfortable writing extensions and/or using the API and/or using Javascript, this is NOT the way to go, because of the maintainability issue.

The most "correct" way would be an extension with hook_civicrm_buildForm to modify the text on the page - though I'd probably just use the extension to load a line or two of jQuery to get the job done.

EDIT - I just looked at your StackOverflow history, and it seems you're a coder and know jQuery - great! Go ahead and download civix, which lets you create a new extension (civix generate:module NewExtensionName). Then check out the Resource Reference to see how to add JS to a form using hook_civicrm_buildForm. If you know PHP, you can also check out the Region Reference to see how to inject a bit of HTML into the middle of the page. The $form object should contain the name of the registrant.

Your Answer

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

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