Hide past event in fullcalendar

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3118

    Hello,

    Firsyt, thanks a lot for that nice plugin.

    All is in the title, is there a way to hide past event in the [eo_fullcalendar] display ?

    Thanks a lot
    Fab

    Fab
    #3132

    Hi Fab,

    There isn’t an option for this (currently at least), but you can use the eventorganiser_fullcalendar_event filter. This filters the event before its included in the response to the ajax request. You can conditionally exclude the event (checking the start – or end – datetime) by returning false.

    add_filter('eventorganiser_fullcalendar_event','fab_hide_past_event_fullcalendar',10,3);
    function fab_hide_past_event_fullcalendar( $event, $post_id, $event_id ){
        //Callback performs operation
        $now = new DateTime( 'now', eo_get_blog_timezone() );
        $start = eo_get_the_start( DATETIMEOBJ, $post_id, null, $event_id );
        if( $start < $now  )
            return false;
            return $event;
    }
    

    Maybe I’ll add an option for this in 1.8.

    Please note that ajax requests are cached, as such the above code may not take effect immediately. You can clear the cache by re-saving an event.

    Stephen Harris
    #3215

    Hello Stephen,

    Thanks for you workaround, it worked perfectly 🙂

    Keep it up with this awesome work

    Fab

    Fab
Viewing 3 posts - 1 through 3 (of 3 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.