Support

Home Forums WP User Integration Can get the event to accept memnbership level

Can get the event to accept memnbership level

Posted: September 11, 2019 at 3:18 am


crocodilemarketing

September 11, 2019 at 3:18 am

Hey

I have installed Eventespresso and WP user Integration.

And are having problems getting the tickets to work for the different memberships. It not working even for administrator or subscriber

We are using EE 4

The test event setting is http://tinyurl.com/y34ovwsb

The results as administrator http://tinyurl.com/y6yadvau

The results as subscribe http://tinyurl.com/y4ld4s7o

We are using memberpress for the membership levels

Any suggestions


Tony

  • Support Staff

September 11, 2019 at 4:05 am

Hi there,

It not working even for administrator or subscriber

Your example screenshot is a test for ‘Subscriber’ so I’ll use that throughout my response.

The reason it’s not working currently is that within WordPress there is no role called ‘Subscriber’, there is a ‘subscriber’ role with a display name of ‘Subscriber’. The case matters and it will work for subscribers if you simply change the setting to ‘subscriber’.

However, before you start doing this its important to note that checking for roles in this way is discouraged within WordPress (See HERE), doing so should be considered doing it wrong. Will it work? Most likely yes. Will it eventually cause problems? Probably.

EE is simply using current_user_can() to check if the user has the correct capability on their account. A ‘role’ (like ‘subscriber’) is a collection of capabilities so doing the above is basically using this:

current_user_can('subscriber')

A subscriber role does NOT have a ‘subscriber’ capability but the above works for backwards compatibility (again note that EE is just using a WP core function to do this so this is an issue from WP, not EE). It is also the reason that when you ‘fix’ your setting on the ticket if you use ‘subscriber’, the administrator will also not see the ticket as an admin is not a subscriber.

What you should be doing, is using a capability available to each specific role but what cap to use I don’t know as it depends on your set up.

For example, by default, a subscriber will have the ‘read’ capability, if you set that on all of your tickets both subscribers and administrators should have access to the tickets, as will any other role that has the ‘read’ capability. Admins also have the read capability (as do all default roles) so they would also have access to the ticket.

The part that gets a little more tricky is when you want member_level_1 to have access to one ticket type but not another and member_level_2 to have access to the ticket member_level_1 does not have access to. For that, you use capabilities specific to each role, but those can be different depending on setup.

The support post ‘Can get the event to accept memnbership level’ 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