WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] Consider checking DOING_AJAX for is_admin checks (3 posts)

  1. bobbydonovan
    Member
    Posted 1 year ago #

    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/

  2. jonahcoyote
    Member
    Posted 1 year ago #

    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.

  3. jonahcoyote
    Member
    Posted 1 year ago #

    Hi bobbydonovan,

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic