Database error in Photo View

Home Forums Calendar Products Events Calendar PRO Database error in Photo View

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1285288
    Kevin
    Participant

    Our Calendar default view is “Photo” from Events Calendar Pro. Loading that page throws off the following DB error in Query Monitor. Looks like a typo somewhere, though I haven’t found it just yet

    SELECT SQL_CALC_FOUND_ROWS *
    FROM ( ) a
    GROUP BY IF( post_parent = 0, ID, post_parent )
    ORDER BY EventStartDate ASC
    WP_Query->get_posts()
    wp-includes/class-wp-query.php:2846
    WP_Query->query()
    wp-includes/class-wp-query.php:3238
    WP_Query->__construct()
    wp-includes/class-wp-query.php:3347
    Tribe__Events__Query::getEvents()
    wp-content/plugins/the-events-calendar/src/Tribe/Query.php:1017
    tribe_get_events()
    wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php:218
    tribe_has_previous_event()
    wp-content/plugins/the-events-calendar/src/functions/template-tags/loop.php:236
    tribe_get_template_part()
    wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php:131
    tribe_get_template_part()
    wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php:131
    tribe_get_view()
    wp-content/plugins/the-events-calendar/src/functions/template-tags/general.php:45
    Tribe__Events__Templates::load_ecp_into_page_template()
    wp-content/plugins/the-events-calendar/src/Tribe/Templates.php:478
    apply_filters(‘the_content’)
    wp-includes/plugin.php:203
    the_content()
    wp-includes/post-template.php:240
    load_template(‘~/wp-content/themes/geekwire/templates/content-page.php’)
    wp-includes/template.php:686
    locate_template()
    wp-includes/template.php:643
    get_template_part(‘templates/content’,’page’)
    wp-includes/general-template.php:167
    Plugin: the-events-calendar You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) a GROUP BY IF( post_parent = 0, ID, post_parent ) ORDER BY EventStartDat’ at line 5

    #1286199
    Cliff
    Member

    Hi, Kevin. Sorry you’re experiencing this.

    I haven’t seen this reported by others, and I wasn’t able to reproduce the issue on my own testing site.

    Please delete The Events Calendar and Events Calendar PRO plugins and install fresh versions from the wp-admin plugin installer after downloading the latest versions from https://theeventscalendar.com/my-account/downloads/

    Deleting The Events Calendar or its add-on plugins will NOT delete any of your data if you delete it via the WordPress plugin manager because that’s how we’ve decided to code our plugin.

    FYI: deleting any plugin via FTP or cPanel’s File Manager (i.e. deleting just the files from the server) will also ensure a plugin gets deleted (if you delete the entire plugin folder) without removing any data from the database. This can sometimes be helpful to know in cases where a plugin does run an uninstall routine to delete data (again, our plugins do not run such a routine at this time and probably never will).

    You can also see the difference when you click to delete a plugin, like this.

    #1288465
    Kevin
    Participant

    I have found the cause of this. Events Calendar Pro does some SQL manipulation in the posts_requests filter.

    Advanced Post Cache is a query caching plugin from Automattic that creates hashes of SQL queries and caches them on this same filter hook.

    https://github.com/Automattic/advanced-post-cache

    Because Advanced Post Cache is loaded first as an MU plugin, and it has the same priority as Events Calendar posts_where filter, the Advanced Post Cache is firing too early, since Events Calendar posts_where is making SQL changes after it.

    Not sure who is the best to fix here. Either load your filter earlier or have Advanced Post Cache load later.

    Have you come across this on WP VIP? Or is the plugin VIP certified?

    #1290258
    Cliff
    Member

    Kevin, thanks for the detailed report. I’ll pass it on to our developers to see if they can confirm, but can you first tell me if you use this plugin as a regular plugin instead of a “must use” plugin, does it work and still have this conflict?

    Regarding VIP, no our plugin is not available for WordPress VIP at this time.

    #1290690
    Brook
    Participant

    Howdy Kevin,

    Thanks for the detailed report and debugging. It is helpful to know where the error stems from.

    This could be considered a bug in Advanced Post Cache. If it needs to run after all other filters, which in this case it appears to, it should be attaching itself with a large priority number. A priority number equal to PHP_INT_MAX would be perfect, as that is the absolute last thing that can run.

    A pull request to Advanced Post Cache could fix that problem with The Events Calendar and any other plugin that uses this WP Filter.

    Or, if you wish to remove_filter() for that method, and then reattach it with a higher priority you should be able to correct this conflict without altering either plugin.

    Does that all make sense?

    Cheers!

    – Brook

    #1292231
    Kevin
    Participant

    Here is the thread in the Advanced Post Cache repo

    https://github.com/Automattic/advanced-post-cache/issues/11

    #1292375
    Cliff
    Member

    Great. Thanks for sharing.

    Please note that threads get Closed automatically after a few weeks of inactivity. If it does get Closed, please open a new thread, adding your current problem description and also linking back to this thread.

    Thank you!

    #1302923
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Database error in Photo View’ is closed to new replies.