Support

Home Forums Event Espresso Premium Debugging Event Espresso & firing off additional mails on registration

Debugging Event Espresso & firing off additional mails on registration

Posted: February 3, 2017 at 7:40 am

Viewing 6 reply threads


Airborne Experience

February 3, 2017 at 7:40 am

I’m trying to get the debugging going on Event Espresso so I can see what objects I’m working with.

I’ve installed https://wordpress.org/plugins/kint-debugger/ as per your recommendation in another support query but when I use d() on the objects I dont seem to get anything back?

Processing just carries on as normal.

I’m wanting to fire off a mail to a 3rd party with some attendee details but need to parse the data returned to figure out where to send it.

I’ve been using the snippet at https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/jf_ee_process_multi_wpuser_for_attendees.php to test the debugging with Kint as I was thinking I could add in additional code their to do my checks and fire off the mails.

I’ve got the snippet implemented as a mu-plugin.


Tony

  • Support Staff

February 3, 2017 at 10:21 am

Hi there,

We don’t provide support for customizations such as these on the forums, whilst I can try and help point you into the right direction you may need the help of a developer.

The above snippet of code you are using processes the attendee details on an ajax request, to view the output from kint on that function you likely need to capture the request and view it through something like Chome Dev Tools.

Where are you adding the code?

I’m also not so sure that’s the right you should be using for what you need, can you provide some further details of why your sending emails? You may be better using a different hook.


Josh

  • Support Staff

February 3, 2017 at 11:06 am

I don’t think running the kint debugger from the code snippet would work but you can can use an action hook that’s in there that will allow firing off an email with attendee details.

Hook option 1:
do_action( 'AHEE__EED_WP_Users_SPCO__process_wpuser_for_attendee__user_user_created', $user, $attendee, $registration, $password );

fires when a user is created.

do_action( 'AHEE__EED_WP_Users_SPCO__process_wpuser_for_attendee__user_user_updated', $user, $attendee, $registration );

fires when a user is updated.

So let’s say you want to fire off an email when a new user account is created. Your function will look something like this:

add_action( 'AHEE__EED_WP_Users_SPCO__process_wpuser_for_attendee__user_user_created',
'my_custom_email_about_new_user', 
10, 
4 
);
function my_custom_email_about_new_user( 
$user, 
$attendee, 
$registration, 
$password 
) {
// code to send the email goes here
// you have access to the following vars/objects
// $user, $attendee, $registration, $password
}


Airborne Experience

February 3, 2017 at 2:33 pm

Thanks for the help guys.

I’m actually a developer but unfamiliar with Event Espresso so its a steep learning curve.

The aim is to send off an email to different reservations email addresses based on the selection from a drop down select.

The user selects his preferred hotel and we send the reservation request through to the hotel.

So its actually unrelated to creating user accounts and linked more to the purchased tickets.

I’m finding it challenging finding the right hook to action to do what I need it to do.

Thanks for all the help 🙂


Josh

  • Support Staff

February 3, 2017 at 2:44 pm

Do you use the Debug Bar plugin along with the Debug Bar Actions and Filters Addon? You’ll be able to find all kinds of hooks with those.


Airborne Experience

February 3, 2017 at 2:48 pm

Hi Josh,

I actually dont but installing now to have a look.

Thanks


Airborne Experience

February 3, 2017 at 3:20 pm

So..

I’m struggling to get any debugging messages from this? For example, I’ve attempted to use Kint, tried to debug to console using:

function debug_to_console( $data ) {

    if ( is_array( $data ) )
        $output = "<script>console.log( 'Debug Objects: " . implode( ',', $data) . "' );</script>";
    else
        $output = "<script>console.log( 'Debug Objects: " . $data . "' );</script>";

    echo $output;
}

and I cant see what the objects contain?

I can see the hooks firing off in the debug bar but I should be able to action what I need in the hook you provided but nothing comes back?

So I can find the different hooks but if I cant debug these objects then I’m flying blind.

Any ideas?

Viewing 6 reply threads

The support post ‘Debugging Event Espresso & firing off additional mails on 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