CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Custom participant fields in event confirmation email?
Pages: [1]

Author Topic: Custom participant fields in event confirmation email?  (Read 1134 times)

dafeder

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: Drupal 6
  • MySQL version: 5.092
  • PHP version: 5.2
Custom participant fields in event confirmation email?
May 05, 2011, 09:51:53 pm
Hi, I'm trying to find a way to include custom Participant fields in my event confirmation emails. I have some custom fields in my Participant records that get calculated and set on event registration. I'd like to include these values in the confirmation emails that go out to users after they register.

If it's easier, I'm also happy to set up a separate email with just this information in it, as long as it gets sent at the same time or even the same day as my confirmation emails. Unfortunately, I'm finding the mail template system among the more impenetrable parts of Civi.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Custom participant fields in event confirmation email?
May 05, 2011, 10:12:48 pm

a couple of options (since i've not tried them, i dont know which will work):

1. Use token hooks

http://wiki.civicrm.org/confluence/display/CRMDOC40/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmtokens

This would work great and is the most ideal. However i'm not sure if you have the event id / participant id and we can figure out how to make the hooks get this information a bit easier if not available right now (i.e. give the hook a lot more context with regard to the call)

2. Use alterMail hook

I dont like this as much since u'll basically be munging the text/html of the email directly. U'll still have the same issue of not knowing the participant id of the contact

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

dafeder

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: Drupal 6
  • MySQL version: 5.092
  • PHP version: 5.2
Re: Custom participant fields in event confirmation email?
May 06, 2011, 08:58:26 am
Hi Donald - I added this to my module:

Code: [Select]
function XXX_civicrm_tokens(&$tokens) {
  dsm($tokens);
}

to check what's in the tokens array. When I register for an event, the hook runs, but I see an empty array, no tokens or anything at all. Does that make sense?

What occurs to me is that, for now, I require people to be logged in to register for events, so I could find their ContactID from their Drupal UID, then grab that person's LAST participant record.

dafeder

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: Drupal 6
  • MySQL version: 5.092
  • PHP version: 5.2
Re: Custom participant fields in event confirmation email?
May 06, 2011, 10:09:21 am
There may also be a participant id lurking in the $_SESSION array, no?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Custom participant fields in event confirmation email?

This forum was archived on 2017-11-26.