Posted: March 11, 2014 at 5:01 pm
|
We have two events, one supporting individual registration and a second that supports group registration. Upon a registration completing, we are generating a WP user for them and sending a confirmation email. This is where we got the original “User Creation” script from: https://gist.github.com/sethshoultes/5574217 The trouble we’re having is selecting the right hook to tie into. action_hook_espresso_save_attendee_data action_hook_espresso_track_successful_sale Any other ideas of hooks we should use to make this work? I would love to find a “Confirmed Registration” hook but it doesn’t appear to exist. |
|
I haven’t tested it, but what about the _email_after_payment hook? All available hooks in EE3 are found here – https://eventespresso.com/wiki/event-espresso-3-1-action-hooks/ |
|
I’ll give it a shot and report back. |
|
No dice. Only the main group member who actually made the payment has a user created for them. Any of the additional members do not. Suggestions on a work around here? |
|
Thinking about this again, you said “action_hook_espresso_save_attendee_data If you are just concerned about registration emails, you could use this hook, but change the General Setting “Send registration confirmation emails before payment is received?” to No. That way no emails would go out until the payment was received. Other than that I could only suggest a custom function based on one of the other hooks that takes the session ID and searches the events_attendee table for the attendees with that session ID (attendee_session column). |
|
I looked into it and turns out we have had the “Send registration confirmation emails before payment is received?” set to “No” this entire time and it was still generating the user prior to payment. |
|
What I’m going to try is using the action_hook_espresso_update_attendee_payment_status hook so that whenever an attendee’s status is changed to “completed”, the user is generated and a welcome email is sent. My concern is what happens if a user is “confirmed”, we then change their status back to “pending” and to “confirmed” again? Will the password email send a second time or will the user creation fail because the email address is already associated with a user? |
|
Hi
This should not occur, unless the user is marked as Completed for any reason. I would revert to a default copy of the plugin (i.e. no modifications) and see if that still occurs.
It depends on how you code it. The snippet Seth made was based on the users email, so it would (correctly) fail if that email exists and not create a user. You would need to make sure that there was something in place to do the same. |
|
We ended up writing a custom plugin that uses two of the hooks and a filter to achieve what we needed. action_hook_espresso_save_attendee_data action_hook_espresso_track_successful_sale Thanks for your help! |
|
Awesome! Glad you got it sorted! |
The support post ‘Hook for User Creation’ 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.