Event Category Filtering not working on AJAX views with ver 3.10

Home Forums Calendar Products Events Calendar PRO Event Category Filtering not working on AJAX views with ver 3.10

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #973629
    Matthew W Kanner
    Participant

    I am doing some custom filtering based on event categories. I have 3 categories I am excluding from all views (except when specifically viewing one of these categories). I worked out the code and had it working both on page load and the AJAX updates (when going Previous/Next) by using the ‘tribe_events_pre_get_posts’ hook.

    It was working great, that is, until I upgraded to version 3.10.

    You can see the code here: http://pastebin.com/SpRcauKx

    I’m hoping there is something I can do to make this work again. It does work when I first load any view (List, Day, or Month), however as soon as you use one of the Prev/Next links, the AJAX refresh seems to ignore the custom filtering. However, prior to these plugin versions it was working (on 3.7 and 3.9).

    I understand this is a customization which you can’t always necessarily support, but any help or pointers you could give would be much appreciated since it worked in the previous version of the code.

    #973885
    Brian
    Keymaster

    Hi,

    Thanks for using our plugins.

    I can try to help out here.

    I loaded up the snippet and see it working as you said on the initial load.

    However, it does not appear the hook it is connected to runs on the Ajax call for the next and previous pages.

    It maybe you can change the priority on the action you are using and see if that can get it. I do not have any other ideas at this time.

    Let me know if you have any follow up questions.

    Thanks

    #973918
    Matthew W Kanner
    Participant

    OK, I tried changing the priority but still not luck (tried values of 5 and 10 for priority).

    In previous versions of the plugin, this hook did run on the AJAX load. I know lots of changes were made in the 3.10 release though. Is there a way for you to find out from a developer if there is an additional hook I need to use now? I read through the release notes (which were great – thank you!), but didn’t find anything that seemed to address it.

    Thanks!

    #975225
    Brian
    Keymaster

    Sorry for the delay here. Your ticket got assigned to another Brian and I missed it.

    We are out for the 4th right now, but next week I can see about that hook.

    Thanks

    #976171
    Brian
    Keymaster

    Ok that hook is the only hook available we did not make changes there.

    However, I did get another pair of eyes on the coding and this part maybe causing the issue:

    //If we're in the admin, make no query alterations
    if ( is_admin() )
    return $query;

    I removed that and it seem to work for me on my site. Since the events are being loaded by ajax it is actually in the admin when the query is modified and that conditional there would stop it from working.

    Let me know how that works out.

    Cheers

    #976191
    Matthew W Kanner
    Participant

    Hmmm….OK, that would make sense. I didn’t know the AJAX was happening on the Admin side of things. I didn’t use to have that in there, but I added it when I realized that the admin events were also being filtered out (and therefore couldn’t be edited). I will address that issue in another way.

    Thank you so much. I feel foolish having it be so simple, but I appreciate the extra eyes helping to sort it out. I will replace it with a different type of check.

    #976222
    Brian
    Keymaster

    Yep, all ajax in WordPress goes through:

    /wp-admin/admin-ajax.php

    To target the frontend only you could look to using this conditionals:

    https://gist.github.com/jo-snips/2415009

    Let me know if you can get that to work.

    Thanks

    #988367
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Event Category Filtering not working on AJAX views with ver 3.10’ is closed to new replies.