Can't do a booking after I cancelled my first one

WordPress Event Management, Calendars & Registration Forums General Question Can't do a booking after I cancelled my first one

This topic contains 7 replies, has 2 voices, and was last updated by  Olaf Lederer 6 years, 6 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #28664

    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
    #28665

    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
    #28673

    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
    #28677

    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 6 years, 6 months ago by  Olaf Lederer.
    Olaf Lederer
    #28684

    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
    #28690

    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
    #28703

    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
    #28704

    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
Viewing 8 posts - 1 through 8 (of 8 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.