Posted: April 3, 2017 at 1:04 pm
|
When tickets are purchased for one or more attendees, I need to run custom code on any newly registered user. What action hook and code can I use to get the user id’s of any newly registered users (purchaser or additional attendees)? I found the action AHEE__EE_Registration_Processor__trigger_registration_update_notifications but I’m not sure how to get the related users, or test if they’re newly created. Thanks! |
Hi SMills, New created users, as in newly create WP Users created by the WP User Integration add-on or something else? (May seems like an odd question but just want to be sure) |
|
|
Good question. Yes, we’re using the WP User Integration add-on. That add-on also creates a WP user for additional attendees, right? Thanks! |
No it does not, not by default. It only creates a user account for the primary registrant. We do have a snippet that creates user accounts for each attendee, however note that its not the default behavior so may have unexpected results (although none that we know of): Also, note within that function there is this hook:
Which is fired for each user created from a registration, and also this hook:
Which is fired each time a WP user is updated (not created) Which should help with your initial question. |
|
|
Thank you! Looks like that did the trick. |
You’re most welcome, I’m glad that worked for you. |
|
|
Hey, Tony. After upgrading EE core, the additional attendees are no longer registered as WordPress users. I’m still using the code here: thanks! |
Hi there, May I ask are you logged in to the site when you register for the multiple attendees? |
|
|
No, I’m not logged in. What we want is for all attendees to end up with WordPress user accounts, so I’m testing not logged in every time. This is the code that never seems to fire, so the actual registration code never gets called:
|
May I ask where do you have the code loading from? Is it from within an activated WordPress plugin? |
|
|
It’s in the functions.php. |
OK that’s why the code isn’t firing then. A theme’s functions.php file loads after the There’s a nice explanation here: You can load the code from https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ |
|
|
Thanks! Looks like that did the trick. |
The support post ‘Get all related user id's when tickets are purchased.’ 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.