Support

Home Forums Event Espresso Premium Hook into sucssesful registration.

Hook into sucssesful registration.

Posted: May 14, 2015 at 10:21 am


Zoe E

May 14, 2015 at 10:21 am

Hi, We are integrating Event Espresso into a CRM, and need to get when someone has booked onto a course all their details.

What hook would we have to use to get this details and send it of to the crm.

Many Thanks.


Lorenzo Orlando Caum

  • Support Staff

May 14, 2015 at 11:17 am

Hi, a member shared a solution on linking a registration with an affiliate program. That runs after registration checkout. You can see their sample code here:

https://github.com/ds-festival/event_espresso_4_custom/blob/master/espresso_custom.php


Lorenzo


Zoe E

May 15, 2015 at 4:45 am

Hi Do you have a list of all the variables that can be given?

so like,
$Attendee->email()

As i have tried to implode the array and email myself whats in there but it causes it to fail.

If there a way i can see whats all in that array that would be helpful. Also will i be able to get multiple attendees details this way as well?

Many Thanks


Dean

May 15, 2015 at 5:56 am

Hi,

In the code Lorenzo linked to I just added:


echo "<pre>" . print_r( $Attendee, 1 ) . "</pre>";
wp_die();

and it gave up data like this (http://pastebin.com/P2sjCyev), but you need to view it from the Network area in your browser console (screenshot http://take.ms/QQzKL). The wp_die may not be strictly necessary.

I didn’t test the multiple attendees, but it should work for them.


Zoe E

May 15, 2015 at 6:47 am

Hi, thank you however I am struggling to get any data from it out.

So i ahve done
$Transaction->tkt_id()

to get the tickets ID but it don’t work. i am a b it confused of the syntax i need to use to get the data out, so i need the ticket ID from that one, Also all the attendee details as well.

Any way you can help us work out how to pull the data.


Dean

May 18, 2015 at 12:48 am

Hi,

Object Orientated (OOP) PHP is somewhat different. There’s a list of some basic methods for the EE_Transaction class here: /wp-content/plugins/event-espresso-core-reg/core/db_classes/EE_Transaction.class.php

For most data points int he objects you can use the general get() method.

e.g.

echo "<pre>" . print_r( $Transaction, 1 ) . "</pre>";

//use the registrations() method to get those objects
$reg = $Transaction->registrations();
foreach ($reg as $key) {
  //loop through and use the get method to extract the protected data
  echo $key->get('TKT_ID'); 
}

wp_die();

So that uses the registrations() method to get that broad data object into an array, then I simply looped through (in case of multiple registrations) and used the get() method to pull out the TKT_ID values.

You can do something similar with the attendee (check here for related methods /wp-content/plugins/event-espresso-core-reg/core/db_classes/EE_Attendee.class.php ), such as

echo $Attendee->e_full_name();

I hope that helps, I know OOP is somewhat confusing, but once you realise that you must use the appropriate methods to get the data rather than trying to access to the objects directly, it becomes a lot easier.

The support post ‘Hook into sucssesful registration.’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso