Booking no longer available – Series bookings

WordPress Event Management, Calendars & Registration Forums Report A Bug Booking no longer available – Series bookings

This topic contains 4 replies, has 2 voices, and was last updated by  jasonb 9 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12663

    Hi Stephen,

    Closed events (Entire series mode) do not appear to display the “Bookings are no longer available for this event” after the ticket end date…

    E.G. A six week course starting 16/09/2014 through to 21/10/2014, which is configured for ticket sales between 06/08/2014 –> 12-09-2014 is obviously now closed for bookings. As a result, the booking form does not display, which is correct but no additional information is displayed to the end user informing that bookings are now closed…?

    eo-booking-form.php exists within the theme directory and does contain code //Check if event has finished. code…

    Can you please advise on this issue?

    Regards

    J

    jasonb
    #12714

    Hi Jason,

    Yes you’re right – currently the plug-in simply checks if there are any tickets currently on sale. This happened as part of a code clean up (it originally checked if there were any tickets for this event, and then discarded ones which were not on sale). As it is, the plug-in cannot distinguish between events which have tickets which are not yet on sale, events which have tickets which are no longer on sale, or events which were never ticketed.

    This will be addressed in a future update, though there is no ETA yet.

    Since the booking form is not loaded in instances where there are no tickets, changes there won’t take affect. Instead, you can add the following in a utility plug-in / theme’s functions.php

    To display a message, you can use the following:

    function my_display_booking_message( $content ) {
    
        $p_id = get_the_ID();
    
        if( !eventorganiser_pro_get_option( 'disable_automatic_form', false ) && is_singular( 'event' ) && 'event' == get_post_type( $p_id ) ){
             if( !eo_get_event_tickets( $p_id ) ){
                 //No tickets created for event.
                 return $content;
             }else{
    
                   $occurrences = eo_get_bookable_occurrences( $p_id ); //By default this is future occurrences.
                   $occurrence_ids = 0;
    
                   if( !$occurrences ){
                        //E.g. event has finished.
                        $content .= '<p> Bookings are no longer available for this event. </p>';
                   }else{
    
                         //If booking 'by date' uncomment next line.
                        //$occurrence_ids = array_keys( $occurrence_ids );
    
                        if( !eo_get_event_tickets_on_sale( $p_id, $occurrence_ids ) ){
                             //No tickets on sale
                             $content .= '<p> There are current no tickets on sale for this event </p>';
                        }
                   }
             }
        }
    
        return $content;
    }
    add_filter( 'the_content', 'my_display_booking_message', 9999 );
    Stephen Harris
    #12727

    Hi Steve,

    Ok, sure and thanks for the update. I have implemented the code to display the message but I’m recieving the following error:

    Fatal error: Call to undefined function eo_get_bookable_occurrences() in … functions.php

    Can you please advise?

    Regards
    J

    jasonb
    #12731

    You’ll need 1.8+ (otherwise, replace it with eo_get_the_future_occurrences_of().

    Stephen Harris
    #12771

    Thanks, that seems to have done the trick.

    Regards

    J

    jasonb
Viewing 5 posts - 1 through 5 (of 5 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.