Support

Home Forums Event Espresso Premium How to make capabilities, and add multiple capabilities to ticket

How to make capabilities, and add multiple capabilities to ticket

Posted: June 30, 2020 at 2:33 pm


ICLE

June 30, 2020 at 2:33 pm

Trying to find a way to allow users with several capabilities to access with “and” or “or” when multiple roles or capabilities are listed in the ticket capability requirement.

Use Case:
Jim has a custom role of “01_jan” and a custom role of “bike_law”
I need for a ticket to only display for him. This is an “AND”

How should I interpret a role into a “capabilities” so I can effect these sorts of cases?

Possibly something similar to this:
https://eventespresso.com/topic/wp-user-integration-allow-two-different-roles-to-a-ticket/


Tony

  • Support Staff

July 1, 2020 at 5:38 am

Hi there,

A role is simply a set of capabilities. It’s an easy way to group them together but it should not be used to define what you have access to.

For example, I can give you a user account on my site and set it to have the Administrator role, but I can then remove the capabilities on that account to match say a subscriber. Your account should (and if caps are used correctly will) only have access to exactly the same as what a user with a subscriber role would.

Multiple capabilities are not officially supported with the current EE ticket capability check but it is possible to hook in and add your own processing to this.

An example of doing this can be found here: https://gist.github.com/Pebblo/4f035d70b160c86f03442675e3d44e7f

That function allows you to set multiple capabilities separated by a comma and then loops over them to check if the current user has any of those capabilites. So you’ll need to alter that function to check they have each of the caps you set and return a ‘true’ value if they do, otherwise return false as they don’t have access.

The support post ‘How to make capabilities, and add multiple capabilities to ticket’ 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