For our athletic running site, we have added three custom questions to our registration form
1 – Date of Birth
2 – Gender
3 – Team Name
since we need these field to correctly assign a runner to a correct category in a race. At the moment, the answers are being saved into the event_expresso event_answers table, but we’d like to add some custom logic, so we can save the answers for these questions as WordPress User meta_data fields.
Is there a recommended or suggested hook point that we should integrate with, where we’d have the answers and the user ID for the person registering?
It depends on when you want the information saved, for example just after the registration form is submitted or only when the registration has been ‘Approved’.
Based on the above, it sounds like just after the registration form is submitted would be best and for that I’d recommend using the AHEE__EE_Single_Page_Checkout__process_attendee_information__end hook.
Its actually the same hook used by the WP User integration add-on to perform its logic, as you have the EE4 Everything License, I’d recommend taking a look at the code used there as an example:
\eea-user-intergration\EED_WP_Users_SPCO.module.php line 82 – 87
Callback = EED_WP_Users_SPCO.module.php line 797
The hook is passed the SPCO object and the valid data from the form submission.
where we’d have the answers and the user ID for the person registering?
Is this the user currently logged in? Or has the user just been created by the user integration add-on?
The support post ‘Hook function to process custom questions after form submission’ 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.