Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
One more long post | Event Espresso - Staging Server

Support

Home Forums Announcements One more long post

One more long post

Posted: September 9, 2020 at 1:27 pm

Viewing 0 reply threads


Lorenzo Orlando Caum

  • Support Staff

September 9, 2020 at 1:27 pm

I am using the AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful hook in order to do some custom coding with regards to events.

What I ultimately need to do is to get the event id that the transaction/registration was done for; as I want to update the access list for the specific event page when a registration is done and paid for (there is already a page associated with the event, which is already coded and working fine).

I can see in the source code for EE_Payment_Processor.core.php that it passes the payment and transaction objects to the hook.

What I have so far:

add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful', 'evt_add_reg', 10, 2); // I first tried without the extra parameters, but also didn't work
function evt_add_reg($transaction, $payment)
{
global $wpdb;
wp_mail('john-henry@dieselbrook.co.za', 'test', 'test'); //this does fire off, meaning that the hook does work
$payment_object = $payment instanceof EE_Payment ? $payment : null;
$event = $payment_object->get_first_event(); //this will get the event?
$event_id = $event->ID();
wp_mail('john-henry@dieselbrook.co.za', 'test object', $payment_object); //this doesn't work, meaning that it can't find the data
}

I have also tried using the passed parameters directly, which didn’t work:

function evt_add_reg($transaction, $payment)
{
global $wpdb;
wp_mail('john-henry@dieselbrook.co.za', 'test', 'test'); // the same applies as above
$payment_object = $payment instanceof EE_Payment ? $payment : null;
$event = $payment_object->get_first_event();
$event_id = $event->ID();
wp_mail('john-henry@dieselbrook.co.za', 'test object', $payment); // the same applies as above
}

Please let me know if the data is structured differently, and if I should adapt my code in order to get the ID (or if there is an easier way to get the id).

Viewing 0 reply threads

The support post ‘One more long post’ 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 - Staging Server