Hi,
On one event, I have 2 tickets: one for members and one for non-members. All members are users in the database. Is there a way that I can force someone to login in order to be able to buy the member ticket? This way, I would avoid having non-members trying to buy tickets at the member price.
Thanks,
Luc
Luc Gagnon
You can do something like the following:
add_filter( 'eventorganiser_get_event_tickets', function( $tickets, $event_id, $occurrence_ids ) {
// Logged-in users can access all tickets
if ( is_user_logged_in() ) {
return $tickets;
}
// Go through each ticket and remove
// any 'members only ones'
foreach( $tickets as $ticket_id => $ticket ) {
if ( $ticket['name'] == 'Members ticket' ) {
unset( $tickets[$ticket_id] );
}
}
return $tickets;
}, 10, 3 );
You’ll have to edit the above to supply the logic for determining whether a ticket is members only or not. In this example, it treats any ticket with the name ‘Members ticket’ as a members-only ticket.
Members tickets will not be visible to logged-out users.
The above also assumes if the user is logged-in then they are member. You can add any additional checks if that might not necessarily be the case (e.g. membership has not lapsed).
Stephen Harris