Support

Home Forums Event Espresso Premium Make an event only available to people who have purchased a particular ticket

Make an event only available to people who have purchased a particular ticket

Posted: October 13, 2015 at 7:17 pm


IanWatson

October 13, 2015 at 7:17 pm

Going into a bit of detail to help explain better… bare with me…

I’m running a ski festival which includes many different events, some of which are included in a festival pass, but also have individual tickets available too.

That part has been a HUGE thorn in my side for year now, yet is so super easy with EE$ and the design of date-times. That’s all set up (thank you for creating such an amazing solution).

BUT… When a person buys a festival pass, they also get Pass Holder Benefits, including discounts on certain items (such as ski lift tickets). Don’t get hung up on the word “discount”. That’s just the bulk rate price we pay the resort… anything we’re looking to sell on EE4 is a fixed rate.

BUT I need these lift tickets to be available ONLY to people who purchased a festival pass.

The easiest way I can figure to do this is to simply create a user role within WP that is “Passholder”. Then limit access to that ticket type based on the role.

Seems easy enough. And when a new user signs up for a festival pass, EE4 is set to automatically create them a user profile with this “Passholder” role. That part is easy.

My problem is if someone has already registered on our website as a “subscriber”, when they buy a festival pass, is there a way that I can automatically change their user role… “upgrading” their role to “Passholder”?

OR is there a better way to do this?

The obvious solution you’re going to suggest is just make different ticket types that include a festival pass and lift tickets. And if I can’t figure this out in time, that’s what I’m going to do. But most of my guests don’t make decisions about these “benefit add-ons” until closer to the time. Which means they wouldn’t be able to buy the lift tickets then, and I lose out on my markup revenue. So I really want them to be able to go back after and add them on.

It should also be noted that I’m using s2Member as my role management plug-in.


Josh

  • Support Staff

October 14, 2015 at 8:55 am

Hi Ian,

You can make it so an existing user account gets automatically updated when they register for a specific event. This does involve doing some custom coding and putting the custom code in a little functionality plugin, so this may require getting a PHP developer involved.

In the WP Users integration add-on’s EED_WP_Users_SPCO.module.php there’s an action hook, ‘AHEE__EED_WP_Users_SPCO__process_wpuser_for_attendee__user_user_updated’. This is the do_action call:

do_action( 'AHEE__EED_WP_Users_SPCO__process_wpuser_for_attendee__user_user_updated', $user, $attendee, $registration );

A new function can be written and attached to this hook. In the function, you can use WP’s set_role() function to update the existing user’s role when they register for the event. The following code is instructional and untested:

# ======= e.g., inside your functions.php file ======= #

/**
 * Define callback function
 * Inside this function you can do whatever you can imagine
 * with the variables that are loaded in the do_action() call above.
 */
function my_update_role_to_passholder( $user, $attendee, $registration )
{
 if ( $registration->event()->ID() == 20 ) { //id of event
  $user->set_role( 'Passholder' );
 }
}

// then add it to the action hook, matching the defined number (3) of arguments in do_action
// see [http://codex.wordpress.org/Function_Reference/add_action] in the Codex 

// add_action( $tag, $function_to_add, $priority, $accepted_args );
add_action( 'AHEE__EED_WP_Users_SPCO__process_wpuser_for_attendee__user_user_updated', 'my_update_role_to_passholder', 10, 3 );

Hope that helps!

The support post ‘Make an event only available to people who have purchased a particular 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