Tribe Bar – remove queries when changing views

Home Forums Calendar Products Events Calendar PRO Tribe Bar – remove queries when changing views

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1494602
    ajoranger
    Participant

    Hello,

    The functionality I’d like – when someone chooses a date in Tribe Bar it works as default, filtering to items from that date forward. But when they change views that date is not retained in the new view. It looks like once the Tribe Bar date filter is set, it appends that query to all URL’s moving forward, even in other views.

    Is there anyway to change this behavior? I managed to hook in using tribe-events-bar-filters and checking tribe-bar-date. But with this method if I remove or change the filters, it impacts using the date filter even when not changing views.

    Please let me know if this is possible.

    #1495158

    Hi Abigail,

    Thanks so much for reaching out!

    By default, when changing views, the “Events From” filter should be retained when switching between views.  I just tested this on my own site and was able to see these results.  The only exception is Month View, where it will just show you the whole month, rather than the events after a certain date.

    Are you seeing the same results?  If not, I’d recommend starting off by going through our testing for conflicts procedure to see what you find out.

    Let me know how that goes!

     

    Thanks,

    Jaime

    #1495381
    ajoranger
    Participant

    Hello Jaime,

    Yes I am seeing what you are seeing, but it’s the opposite of what I want. I’d like some pointers on how to customize so that when switching views the filter is NOT retained. So far here is where I’m at:

    -When someone chooses a date in Tribe Bar, it filters appropriately.
    -When they switch views, it reverts to our desired default query (from today to six weeks out) rather than referring to the date in the Tribe Bar.

    2 issues remain –
    First, when someone switches from List view to Month view, even though it QUERIES from today to six weeks out, the month that first appears is based on the Tribe Bar date entry. So if they choose a June date in List view and switch to Month view it shows an empty June calendar. How can I make the month refer to the query rather than the tribe bar date?
    Second, I can’t figure out how to clear out the Tribe Bar date, ideally I could empty it when someone switches views. I have found “unset tribe bar” via a filter, but that removes all of the html and ruins the formatting rather than just removing the value that has been set.

    This is custom stuff, I don’t want the calendar to follow default behavior if at all possible.

    Thanks!

    #1496169

    Hi Abigail,

    After reviewing your request this essentially looks like a custom development task and so is outside of our stated scope of support.

    With that being said, we’d love to help point you in the right direction.

    I’d recommend starting off by taking a look at our Themer’s Guide, which can show you which templates can be edited and copied in order to attempt the results that you are looking for.

    You may also be interested in this article on how to customize the tribe bar:

    https://theeventscalendar.com/knowledgebase/understanding-the-tribe-events-bar/

    And here is our list of available functions:

    https://theeventscalendar.com/functions/

    If you’d prefer not to tackle this customization on your own, we may be able to assist you further. We do need to prioritize support requests from other customers at this time but I’ll certainly flag this with the team and – although we can’t make any promises – if we have time and space to come back and help, we’ll be happy to do so.  Please let us know if you’d like to go this route so that you can be added to this queue.

    In the meantime, if there is any more information you can share (including mocks) that will help us to better understand what you are seeking please do feel free to add them to this ticket.

    If you urgently need help with this, however, you may instead wish to consider working with a suitably skilled developer or designer who can offer the additional level of support you require.

    Let me know if you have any other questions on this topic!

     

    Thanks,

    Jaime

    #1496388
    ajoranger
    Participant

    Hello Jaime,

    I AM the hired developer and so developer level pointers are appreciated! 🙂

    I have already read the Tribe Bar article you linked and the Themer’s guide and have made significant customizations already. As far as I can tell, documented resources are very focused on display and templating rather than functionality. I totally understand you needing to focus on customers who need help with default functionality. I would love to be added to a queue for further assistance, though.

    I’d really appreciate any pointers on these two specific items:
    1. How to clear the tribe bar date without deleting all HTML formatting.
    2. How to hook in and change the default month that is displayed when going from month view to list view. Specifically, when it seems the month that first displays relies on the tribe bar date vs on the event query.

    I don’t want to edit plugin code, so if hooks and functions don’t exist to do these things just let me know. I didn’t find anything on these in the documentation.

    Thank you for any further assistance, I’d still like to be added to a queue even if there is a long wait time!

    Madeline

    #1496606

    Hi Madeline,

    There is unfortunately not a list of hooks and filters because there is just no better way to find all of the functions and filters and hooks than the actual code itself.

    What I mean is that, because code changes quite often, the best way to find hooks and filters within our plugins is to open the plugin files in your code editor of choice; and then just search for “do_action()” calls to find action hooks, and search for “apply_filters()” calls to find filters.

    And here is our list of available functions:

    https://theeventscalendar.com/functions/

    In the meantime, I will add you to the customization queue.

    Let us know if you have any other questions!

     

    Thanks,

    Jaime

    #1499060
    ajoranger
    Participant

    Hello Jaime,

    Just wanted to let you know I pretty much figured this out. For anyone else looking for an answer:

    I used the following in my functions file:
    add_filter( ‘tribe_get_month_view_date’, ‘revert_to_default’ );

    function revert_to_default($date){
    if ( ! $wp_query = tribe_get_global_query_object() ) {
    return;
    }

    $today = date_i18n( Tribe__Date_Utils::DBDATEFORMAT, strtotime( date( ‘Y-m-01’, current_time( ‘timestamp’ ) ) ) );
    $date = $today;

    if ( isset( $_REQUEST[‘eventDate’] ) && $_REQUEST[‘eventDate’] ) {
    $date = $_REQUEST[‘eventDate’] . ‘-01’;
    } else {
    if ( ! empty( $wp_query->query_vars[‘eventDate’] ) ) {
    $date = $wp_query->query_vars[‘eventDate’] . ‘-01’;
    }
    }

    // Confirm the date is valid (who knows what was passed in through $_REQUEST) and revert to today if necessary
    return $date;
    }

    This removes the “tribe bar date” as a factor for choosing the month that shows when switching from list to month view. I still couldn’t figure out how to clear out the tribe bar itself, but we realized that we didn’t need the date filter on month view for our purposes.

    In order to force the event query to reset on switching views, I did a bunch of additional custom conditionals based on matching strings of $_SERVER[‘HTTP_REFERER’]; and $request = $_SERVER[‘REQUEST_URI’]; to determine if view was being swapped. We also wanted events to not show that are further than six weeks out, so this custom code might not be applicable to anyone else because of this additional parameter.

    Anyway, I’m going to close the thread, thanks!

    Madeline

    #1501023
    Barry
    Member

    Thanks Madeline — we appreciate you sharing those notes 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Tribe Bar – remove queries when changing views’ is closed to new replies.