Hi,
right now it’s not possible get a another ticket after I did a first booking. Even if I cancel the booking, it’s not possible to book again. An admin needs to delete the “old” booking first.
Is there a workaround to solve this? I was thinking about to run a custom script that will delete the cancelled bookings (we don’t sell tickets) so it’s just the information that someone will join the event.
Olaf Lederer
The plugin doesn’t prevent user’s from placing more than one booking for an event by default.
Do you have script which is doing that? It maybe that it is not accounting for canceled bookings.
Stephen Harris
That’s strange, I can’t remember that I changed the form so much. It’s the if then else clause that is using a a check (and hides the form if a booking already exists)
I will check the original file and let you know.
Olaf Lederer
Hi, looks like it happens because of a customization suggested here: https://wp-event-organiser.com/forums/topic/reservations-and-bookings/#post-26507
This behavior is fine for “active” reservations. Is the a way to check also the status from the user’s booking (beside this condition):
if ( ! eo_user_has_bookings( get_current_user_id(), get_the_ID() ) ) {
This way I can show/hide the form for the different booking status. I can write that function by myself, but you created such a function like you did for eo_user_has_bookings()
Thanks
-
This reply was modified 7 years, 3 months ago by Olaf Lederer.
Olaf Lederer
Hi Olaf,
eo_user_has_bookings()
accepts an optional third argument to specify which booking statuses you are interested in. In this case, any status other than the ‘cancelled’ one:
$noncancelled_statuses = eo_get_booking_statuses( array( 'name' => 'cancelled' ), 'names', 'not' );
or probably more appropriately,
$ticket_reserving_statuses = eo_get_reserved_booking_statuses();
Using either of those will ignore cancelled bookings when checking if the user has made any prior bookings.
Stephen Harris
Hi Stephen,
thanks for the code examples. Actually the function eo_user_has_bookings()
has a fourth argument 🙂
This IF clause did it the way I need it:
if ( !eo_user_has_bookings( get_current_user_id(), get_the_ID(), 0, 'confirmed' ) ) {
Olaf Lederer
You’re right, 4th argument :).
Just a heads up, but by using ‘confirmed’, if the user has ‘pending’ booking, that will be ignored (regardless as to whether that pending booking reserves any tickets).
Stephen Harris
Just a heads up, but by using ‘confirmed’, if the user has ‘pending’
booking, that will be ignored
I checked all bookings, but they are always confirmed. A booking is just a signal that a member will join a tour.
Olaf Lederer