Support

Home Forums Event Espresso Premium Restrict a Member from buying a Non-Member Ticket

Restrict a Member from buying a Non-Member Ticket

Posted: July 26, 2022 at 12:30 pm

Viewing 6 reply threads


fuzzyminds

July 26, 2022 at 12:30 pm

Hello,

We have events on our site which have two kinds of ticket. A Member ticket that can only be bought by Members and a Non-Member ticket with a different price which should only be bought by a Non-Member. We’ve capabilities in place for making sure that a Non-Member can’t buy a Member’s ticket.

However, we also want to make sure that a Member, if forgetfully tries to register for a Non Member ticket, then he/she shouldn’t be able to. They should see a dialog which should tell them that they need to login and buy a Member Ticket instead. The key to this problem is the email address.

Pseudo logic: When a member tries to buy a non-member ticket, we will hook a function to an appropriate action/filter(Kindly let us know which filter/action we can use here) after they click on the “proceed to payment options” button while registering. We will check whether the email address the visitor gave already exists in WordPress as a user, if it does then we want to use an Event Espresso method or any other method to stop their registration and display a dialog telling them to login instead.

Forgive us if a similar topic already exists.


fuzzyminds

July 26, 2022 at 12:31 pm

This reply has been marked as private.


Garth

  • Support Staff

July 26, 2022 at 12:46 pm

Hi there,

The WP User Integration Add-on will help you with tickets for members of your website. Combined with the WordPress and Event Espresso capabilities system you can require that people are logged-in to your website before they can purchase tickets and restrict certain types of tickets to those who have the right custom capabilities/privileges.

With our WP user integration add-on, you’ll be able to setup member pricing and also offer public pricing. It works by integrating with a membership plugin like Paid memberships pro or another plugin.

Here is an example of how it works with S2member: http://ee-screenshots.s3.amazonaws.com/ee4/ee4-s2member-roles-tickets.jpeg

You set a capability for a pricing option and then a member that has access will be able to register for those pricing options.

Does that help?


Tony

  • Support Staff

July 26, 2022 at 2:01 pm

Just to give some additional context here, the WP User integration add-on does a similar check to this to see if the submitted email has a WP user account, just not based on the current ticket selection.

The add-on uses the FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process hook and as you have access to it take a look in \eea-wpuser-integration\EED_WP_Users_SPCO.module.php at the verify_user_access method to see how it does that.

Note that hook is fired after SPCO has already started to process the registration, if you want to hook into the process before then that’s also possible but takes a little more work.

There’s a hook for doing so which is AHEE__Single_Page_Checkout__process_reg_step__attendee_information__process_reg_step and a ‘basic’ example of using that can be found here:

https://gist.github.com/Pebblo/0b3b28c9d0c52d5425fa167da1f1a622


fuzzyminds

July 28, 2022 at 6:08 am

@Garth

Thank you for your response. However, in my particular case, this doesn’t help as I have already used the features you mentioned to restrict buying of Member Tickets to Members only. What I need is the exact opposite of this, I need to make sure that a Member, unknowingly doesn’t sign up for a Non-Member ticket.

In the language of how your add-on is designed, it would mean that I want to restrict a certain ticket i.e. “Non-Member Ticket”, to visitors who have no capabilities at all in the system, and if a user with capabilities try to buy it, then a dialogue should be shown telling them to login first.

I hope I have explained it well now.


fuzzyminds

July 28, 2022 at 10:16 am

@tony

So I have made it work using the hook you suggested. Fetched the ticket name from the transaction and enforced a check on it, I was able to accomplish my desired output. You can close this thread now, thank you for the help!


Tony

  • Support Staff

July 29, 2022 at 9:46 am

Great, I’m glad that helped.

Whilst I don’t normally offer to help with custom code, I’ve spent a fair amount of time with both of those hooks for various different features users have requested and will happily offer any advice on a ‘better’ (or the EE way) to do it if you’d like me to review?

No problem if not, just the offer is there 🙂

Viewing 6 reply threads

The support post ‘Restrict a Member from buying a Non-Member 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