Support

Home Forums Event Espresso Premium EE4 – Extending the Submit Registration functionality

EE4 – Extending the Submit Registration functionality

Posted: May 16, 2019 at 11:57 am


mbeede@tracom.com

May 16, 2019 at 11:57 am

Greetings – This pertains to my previous post dated 04-19-2019. After the Submit registration button is clicked, and After EE stores all of the WordPress database information for the new registrant, I need to make some external web service calls using the registration information.

You recommended that I use this hook: AHEE__EE_Single_Page_Checkout__process_attendee_information__end

All of my EE related code is in a custom plugin (i.e. NOT a child theme) so that it is better isolated. So I have this simple function in my PHP file to start:

function my_custom_submit_action ()
{
echo '<script language="javascript">';
echo 'alert("Made it into the my_custom_submit_action function")';
echo '</script>';
}
add_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', my_custom_submit_action);

But it is not being called. I tried a different theme thinking my theme might be at issue, but that is not the case. Since I am using a plugin and not a child theme do I need to do something different, or what am I missing?

Thanks in advance, Mark

  • This topic was modified 1 month ago by  Josh. Reason: code formatting


Josh

  • Support Staff

May 16, 2019 at 12:23 pm

Hi Mark,

That particular hook isn’t intended to be used to output JavaScript to the page. Also, you probably want to access the submitted form data, correct?

What you could do to ensure your code is executing (and ensure you have the data you want to include in your calls) is log some data to the debug.log file of your site. The debug.log file will get written to your site’s wp-content/ folder when WP_DEBUG_LOG is activated & logging calls are fired.

So first, you’ll adjust your wp-config.php file’s WP_DEBUG constant:

define( 'WP_DEBUG', true );
if ( WP_DEBUG ) {
        @ini_set( 'display_errors', 0 );
        define( 'WP_DEBUG_LOG', true );
        define( 'WP_DEBUG_DISPLAY', false );
}

Then add this to your plugin:

add_action(
    'AHEE__EE_Single_Page_Checkout__process_attendee_information__end',
    'log_the_reg_form_submission',
    10,
    2
);
function log_the_reg_form_submission( $spco, $data) {
    error_log(print_r($data, true));
}

Then after you submit a test registration form, tail or open your site’s wp-content/debug.log file to see the results.


Josh

  • Support Staff

May 16, 2019 at 12:41 pm

Please also note from your example:

add_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', my_custom_submit_action);

isn’t correct syntax because the callback function needs to be wrapped in quotes. e.g.

add_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', 'my_custom_submit_action');

The support post ‘EE4 – Extending the Submit Registration functionality’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 1 month ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!