Fatal Error with update to latest version of EO

WordPress Event Management, Calendars & Registration Forums General Question Fatal Error with update to latest version of EO

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 10 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10631

    Hi Stephen,

    When I updated Event Organiser to version 2.7.5, I received the following error: Fatal error: Call to undefined function eventorganiser_is_event_query().

    I had used this function in some code you gave me a few months ago that let me group events in a certain way:

    add_action( ‘pre_get_posts’, ‘shahn1234_group_occurrences’ );

    function shahn1234_group_occurrences( $query ){
    if( eventorganiser_is_event_query( $query )
    && $query->is_main_query()
    && is_tax( ‘event-tag’ ) ){

         $query->set( 'group_events_by', 'series' );
         $query->set( 'event_start_after', 'now' );
    
     }

    }

    Is there an updated version of eventorganiser_is_event_query()?

    Thanks,
    Suzanne

    Ronya Banks
    #10632

    Hi Ronya,

    When a plug-in is updated, it deactivates the plug-in. This means any included functions are not defined (hence the error!). I’ll keep this in mind in future posts, (if you can remember where you got that code, I’ll update it to), but a very easy way to fix the issue is to do the following:

    if(  defined( 'EVENT_ORGANISER_DIR' ) && eventorganiser_is_event_query( $query ) 
       ...

    (That is, adding a defined( 'EVENT_ORGANISER_DIR' ) conditional).

    (This isn’t strictly speaking necessary, it depends on what other plug-ins/themes. In your case it seems that a plug-in/theme is causing the filter pre_get_posts to be triggered during the update routine.)

    Additionally the fatal error will probably have prevented Event Organiser from being re-activated. If you haven’t already, you should activate Event Organiser. This will “fix” the error, but it’ll reoccur when you update it again, unless you use the above code.

    Stephen Harris
    #10676

    Thanks so much, Stephen! That did the trick. 🙂

    I originally got that code from you over at the WordPress support page for your plugin:
    http://wordpress.org/support/topic/sort-order-for-taxonomy-event-tagphp

    Ronya Banks
    #10677

    Great, thanks! I’ve just posted an update on that thread so others don’t get caught out.

    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 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.