Posted: June 7, 2017 at 8:40 am
|
Hi, Background: It is our hope to perform the following scenario: 1) When a non-member of our site registers for an event, EE4/WP-User will create a WordPress account for this user. Note: I was reviewing https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/jf_ee_set_capability_default_user_create_role_event_editor.php – I see this is referring to s2 roles, however I’m not sure if this is even the correct hook to use. Any advice is much appreciated – thanks. – Christian |
Hi Christian, You can assign a default membership level to new users upon registration in Event Espresso > Registration Form > WP User Integration settings > Default role for User Creation on Registration. The code snippet you reviewed is useful for removing choices from that selector. The selector grabs all user roles, but you may wish to remove some of those choices by applying that code. |
|
Hi Christian, If I recall correctly, PMP does not use ‘roles’ in the same way S2 or similar does, I think the membership level is completely separate from the WP User role. If that’s the case the hook you’ll likely want to look into is:
That would be fired specifically for users created by EE so you can then run You could also use the wp hook |
|
|
Thank you both. @Tony – We are using an addon that allows us to define custom roles for PMP, but in reality Thank you again for the tips – I will report back if I encounter any other obstacles. |
If that add-on hooks into |
|
|
Thanks. I’ve been able to successfully create and assign membership levels using the above info. I have a follow-up question: Is it possible to identify the ticket selected for an event registration? My hope is to be able to be able to auto create membership, using the above, based on the type ticket selected. In other words, if user selects a ticket that includes membership, invoke Hope this makes sense – let me know if this makes sense or if you need me to clarify anything. Thanks, |
Using the hook I mentioned above? Registrations have a one-to-one relationship with tickets so if you have a registration, you have the ticket fo that registration. You need to have an instance of EE_Registration then you can pull the ticket for that registration using something like:
Then $ticket will be an instance of EE_Ticket which you can pull various details from. I’d recommend installing Kint and then wrapping the objects in |
|
The support post ‘EE4 – Assign a default membership level to new users upon registration’ 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.