WordPress.org

Support

Support » Plugins and Hacks » The Events Calendar » [Resolved] Consider checking DOING_AJAX for is_admin checks

[Resolved] Consider checking DOING_AJAX for is_admin checks

  • Hello,

    Whilst building a custom addon to your plugin I came across an interesting problem whereby ajax calls on tribe_get_events() were not correctly filtering on the start_date and end_date criteria given.

    I was able to track this down to TribeEventsQuery::setupQuery where is_admin() is checked before crucial add_filter(s) that enable these arguments to be correctly filtered. The problem is, calls from admin_ajax.php make all checks on is_admin() return true.

    I was able to make this work by altering the conditional on line 18 of lib/tribe-event-query.class.php from:
    if ( !is_admin() && (
    to
    if ( (!is_admin() || ( defined('DOING_AJAX') && DOING_AJAX ) ) && (

    Obviously not the best way to get around the issue considering it will be overwritten next time the plugin is updated, however perhaps you might consider adding this into a future version. And perhaps doing the same for any similar functions in other areas of the plugin I have not come across.

    http://wordpress.org/extend/plugins/the-events-calendar/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey bobbydonovan,

    Thanks for this. I’ve passed it on to one of our devs to take a look at. We’re getting closer to releasing 3.0 so I’m not sure whether or not this will still be valid in the new version, but we’ll see.

    Hi bobbydonovan,

    I just wanted to update here that this has been confirmed fixed in 3.0!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Consider checking DOING_AJAX for is_admin checks’ is closed to new replies.
Skip to toolbar