Posted: May 6, 2021 at 12:41 am
|
I need to set limit of ticket with different user role wise.. |
Hi there,
This is not something we have within Event Espresso currently, we don’t limit ticket qty’s based on user/capability/role so this would require custom development.
I’m not sure I understand this, can you explain a little more please? |
|
|
In the previous version EE#3 , template copies on the wp-content/theme/registration_page_display.php file directory also i used ‘action_hook_espresso_save_attendee_data’ hooks is there a similar structure in EE4? Thanks! |
Yes, EE4 has thousands of hooks, it just depends on when you want your code to execute. For example, if you are looking to remove the ticket selector and display a message in place of it when a user has previously register there is an example here: https://gist.github.com/Pebblo/10669adfeea322ade3d96a38857fb46b |
|
|
Hello, Thanks for help.. Thanks!! |
Sure, at what specific point during execution do you want to hook in? It works differently in EE3 as the registrations are created early on and then updated as you progress through the reg steps. So you could use:
To hook in BEFORE spco has processed each individual registration. Or if you want to hook in after the attendee_info reg step has been processed you could use:
There are many hooks on every request so I’ll need more specific details on what and when you want to hook in to advise further on a specific hook you can use. To go with the above I highly recommend you take a look at the doc for our model system: https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System You’ll need to understand the models to be able to pull in any data you need for the registration etc. |
|
|
Hello, |
Checking this on the registration form is after the user has submitted tickets, that means the tickets they selected are going to go in reserve for the duration of the user’s session (by default 1 hour). Ideally you want to do this on the ticket selector using something similar to the snippet I gave you earlier: https://eventespresso.com/topic/registrtion-limit/?view=all#post-323670 However, not that checking a users ‘role’ for this would be considered doing_it_wrong(), you should use capabilities on the role, not the role itself. Take a look here: https://developer.wordpress.org/reference/functions/current_user_can/
Again, the snippet above is the closest to what you are requesting already. You’ll need some custom code to count/compare/save the ticket count/limit and then display the message as we don’t have anything within core that will do that for you. |
|
|
Hello, |
Do you mean the ‘Maximum number of tickets allowed per order for this event:’ value? If so you can change that in Event Espresso -> Events -> Default Settings (tab) -> ‘Default Maximum Tickets Allowed Per Order’ |
|
The support post ‘registrtion limit’ 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.