Support

Home Forums Event Espresso Premium One ticket, two roles, need to know the role ID

One ticket, two roles, need to know the role ID

Posted: November 19, 2018 at 9:07 pm


BCPTA

November 19, 2018 at 9:07 pm

Hello,
This may seem like a silly question, but I’ve been trying to read up on it, and can’t seem to find the answer.
I am trying to do exactly what is described here: https://eventespresso.com/topic/wp-user-integration-allow-two-different-roles-to-a-ticket/

However, I’m unclear on one thing: how does the system know which capability is the one that allows both user roles to buy a single ticket?

Note: our user roles are also PM Pro members.

We have User Role Editor installed. I’ve tried to edit a role that can currently buy one type of ticket. I look for EE capabilities in the User Role Editor admin screen, and they are all back-end, admin stuff, like editing or deleting events, and so on.

Where is the capability that allows a role to buy a ticket? What is it called? Does it have an ID name?

I can add a capability in User Role Editor, but it only asks me to name the ID. Now, I can make something up, like “buy_member_2_ticket” or whatever. But then, how does it ‘know’ what that name means?

So I looked here:
https://developer.wordpress.org/plugins/users/roles-and-capabilities/
https://codex.wordpress.org/Function_Reference/add_cap

And it seems like the capability needs to be coded in. But I’m thinking – doesn’t one exist already? And where is it? What is it called? Can I enter an existing one built into EE4?

Adding additional roles or capabilities to a single user’s profile doesn’t do the trick here (tried it). We are willing to go this route, which is more manual, but the ticket list seems to only ‘understand’ the user’s primary role when they log in to buy a certain ticket.

Hope I’m making sense…

Thank you for your help.

For extra context:

We are using PM Pro.

We want pmpro_role_6 and pmpro_role_7 to be allowed to be pmpro_role_1 tickets.

Here is a sample page (if you need it): https://www.bcplaytherapy.ca/events/introduction-play-therapy-6ceus/


Tony

  • Support Staff

November 20, 2018 at 5:16 am

Hi there,

Sounds like there is some confusion over roles vs capabilies, I’ll run through your questions and then explain further afterwards.

However, I’m unclear on one thing: how does the system know which capability is the one that allows both user roles to buy a single ticket?

You would use a capability that has been set on both roles you want to purchase the ticket, a role just is a collection of capabilities, without those capabilities, the role doesn’t/shouldn’t mean much.

For example, I could set you up and account on my site with the Administrator, but if I remove all but the ‘read’ capability from your account, you role may well be ‘Administrator’ but your capabilities only allow you to do what a subscriber can do… read.

To allow EE to work with the majority of Member plugins we use capabilities, your problem (iirc) right now is PMP is a little different and you may need one of their add-ons for it to function with capabilities.

Where is the capability that allows a role to buy a ticket? What is it called?

There isn’t one by default, you set whichever capability you want to use based on your setup and it’s different is you are using a membership plugin vs just standard WP accounts.

Does it have an ID name?

My apologies, but I’m not sure what this means.

I can add a capability in User Role Editor, but it only asks me to name the ID. Now, I can make something up, like “buy_member_2_ticket” or whatever. But then, how does it ‘know’ what that name means?

Which ‘name’? Can you add a screenshot of what you are looking at?

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots

And it seems like the capability needs to be coded in. But I’m thinking – doesn’t one exist already? And where is it? What is it called? Can I enter an existing one built into EE4?

Generally, additional capabilities do NOT need to be coded for this to work but it does depends on how your roles are set up. EE does not add (nor does it need to) a capability specifically for purchasing a ticket.

Adding additional roles or capabilities to a single user’s profile doesn’t do the trick here (tried it).

What doesn’t work? What steps did you try?

We are willing to go this route, which is more manual, but the ticket list seems to only ‘understand’ the user’s primary role when they log in to buy a certain ticket.

EE doesn’t care about the ‘role’, you should not be setting the users role in the capability field, it checks for capabilities on the users account, not what ‘role’ they have.

Having said that, it gets a little confusing because at one point WordPress DID use allow you to check for a role as a capability, but its not how it should be done and they now discourage it, so setting the role within the capability will actually most likely work but not with multiple roles.

We want pmpro_role_6 and pmpro_role_7 to be allowed to be pmpro_role_1 tickets.

It’s been a little since I last used PMP (I’ll install it now and refresh) but it needs to ‘stack’ capabilites for that to work, ie:

For example pmpro_role_6 needs to have capabilityes A,B,C

Then pmpro_role_7 has A,B,C + its own capabilites (meaning it has the same access as role_6 + the capsabilites for whatever role_7 can do.

The support post ‘One ticket, two roles, need to know the role ID’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 11 months, 4 weeks ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!