Support

Home Forums Event Espresso Premium EE4 Ticket Capability Requirement, I want to add multiple custom capabilites

EE4 Ticket Capability Requirement, I want to add multiple custom capabilites

Posted: October 5, 2022 at 3:39 pm

Viewing 4 reply threads


calthoracic

October 5, 2022 at 3:39 pm

For a single ticket, I want to add/enter multiple custom capabilities in the “Ticket Capability Requirement” – “WP User Capability required for purchasing this ticket:” field. e.g. “access_s2member_ccap_indv_act_2022, access_s2member_ccap_indv_eme_2022”. fyi – entering a single ccap works but enter more (comma separated) does not.
I found early forum question/answers stating only a single ccap will work but was wondering if there exists a hook etc I can create to override this.


Garth

  • Support Staff

October 5, 2022 at 9:11 pm

Hi there,

Maybe this is a business decision, but what is the need to have multiple capabilities as requirements? If I’m correct, then the user would have to have both capabilities, not one or the other. Are there different groups of people represented by multiple ccaps? Could you offer a different ticket, one for each ccap?


calthoracic

October 6, 2022 at 10:21 am

Garth,
I found a solution that works (function tw_ee_wp_user_ticket_selector_check_multiple_caps). A ticket with multi ccaps will be available to different groups (e.g. physicians, non-physicians, emeritus). Another ticket with different multi ccaps may be available to (e.g. physicians, Rts). Instead of creating many tickets for each group, the multi ccaps require only two tickets (in this example). I have a plethora of tickets with different multi ccaps.
I found the solution after posting Q – I am still figuring out how best to use the forums. I found this solution searching outside the forums.


calthoracic

October 6, 2022 at 10:21 am

Garth,
I found a solution that works (function tw_ee_wp_user_ticket_selector_check_multiple_caps). A ticket with multi ccaps will be available to different groups (e.g. physicians, non-physicians, emeritus). Another ticket with different multi ccaps may be available to (e.g. physicians, Rts). Instead of creating many tickets for each group, the multi ccaps require only two tickets (in this example). I have a plethora of tickets with different multi ccaps.
I found the solution after posting Q – I am still figuring out how best to use the forums. I found this solution searching outside the forums.


Tony

  • Support Staff

October 6, 2022 at 11:32 am

Hi there,

I wrote the above function and I’m glad it come in useful for you. It can be found here:

https://gist.github.com/Pebblo/4f035d70b160c86f03442675e3d44e7f

Just a quick note for yourself (and any future readers) that the above will match the first capability the current user has so the user requires ANY of the capabilities you set on the ticket and not ALL of the capabilities.

Viewing 4 reply threads

The support post ‘EE4 Ticket Capability Requirement, I want to add multiple custom capabilites’ 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.

Event Espresso