custom sorting of Events

Home Forums Calendar Products Events Calendar PRO custom sorting of Events

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1285585
    cyrilsack
    Participant

    Hi TEC Pro Support:

    I’m working with Cyril Sack (owner of the site / plugin) to customize his Events page: https://adventureracehub.com/adventureracescalendar/. Present there in the Find Events drop-down are the 3 default options: Date, Search, & Near (Location). Cy would like to add: Organizer, Difficulty, and Race Length. On that page’s drop-down, you can see where I’ve added Organizer to begin with after following this Help page instructions: https://theeventscalendar.com/knowledgebase/understanding-the-tribe-events-bar/, so it is visible but I cannot get it to filter results once a search for an Organizer is entered — it either spins to no results, or resolves back to the general list instead of showing only the Organizer in question.

    Can you please point me to where I need to go to complete this customization? Thanks in advance!

    Steve C. (on behalf of Cy Sack)

    #1286565
    Trisha
    Member

    Hello, Steve!

    Thank you for using The Events Calendar! I can help with this ?

    Without seeing your code it looks like the modification itself hasn’t made it’s way to the search query. Can you double check to make sure that you’ve added the query to ‘tribe_pre_get_posts’? Additionally, see if $_POST[‘tribe-bar-my-field’] is returning any data.

    Here is a code snippet from the article that should help:

    add_filter( ‘tribe_events_pre_get_posts’, ‘setup_my_bar_field_in_query’, 10, 1 );

    function setup_my_bar_field_in_query( $query ){
    if ( !empty( $_REQUEST[‘tribe-bar-my-field’] ) ) {
    // do stuff
    }

    return $query;
    }

    Does this help answer your question? Let me know how it goes!

    Cheers,
    Trisha

    #1287226
    cyrilsack
    Participant

    Hey, I know you! 😀

    I’ll take a look and see if this is the ticket… thanks Trisha!

    Back in a bit,

    S

    #1287229
    cyrilsack
    Participant

    OK, here is what is & was in place between a buddy of mine and myself looking this over last week — I’ve not changed anything:

    add_filter( ‘tribe-events-bar-filters’, ‘arh_setup_my_field_in_bar’, 1, 1 );
    function arh_setup_my_field_in_bar( $filters ) {
    $filters[‘organizer’] = array(
    ‘name’ => ‘tribe-bar-organizer’,
    ‘caption’ => ‘Organizer’,
    ‘html’ => ‘<input type=”text” name=”tribe-bar-organizer” id=”tribe-bar-organizer” placeholder=”Organizer Name”>’
    );

    return $filters;
    }

    add_filter( ‘tribe_events_pre_get_posts’, ‘arh_setup_my_bar_field_in_query’, 10, 1 );
    function arh_setup_my_bar_field_in_query( $query ){
    if ( !empty( $_REQUEST[‘tribe-bar-organizer’] ) ) {
    $query->set(‘tribe_is_event_organizer’, $_REQUEST[‘tribe-bar-organizer’]);
    }

    return $query;
    }

    So the additional code you suggested from that Help doc seems to be in order… or no?

    Thanks for sticking with us on this!

    Steve

    #1288655
    Barry
    Member

    Hi Steve,

    Apologies for the delay!

    Please do note, though, that the level of support we can provide for custom coding initiatives does tend to be on the limited side. With that said, here are some notes that might help:

    • Your tribe_events_pre_get_posts callback looks pretty good, but you are trying to set the tribe_is_event_organizer query variable which isn’t actually supported – try setting organizer instead
    • Note also that you need to provide the organizer ID, not just a plain piece of text – so you’re probably also going to want to do some work to convert the text provided by the user into one or more IDs

    I hope that helps 🙂

    #1293162
    cyrilsack
    Participant

    OK, Barry — thanks for this response. However, I’m no developer, just an ‘advanced user’/designer, so some of this pure jargonese to my limited understanding. 😀 A more-experienced associate of mine named Jarrod said it was helpful and attempted to assist in getting this operational, but so far we’re not getting filtered results yet with Organizer being our first effort to add as a custom filter.

    While digging around further for more help from Modern Tribe, I went over (once again) all of the features/functions of TEC more thoroughly within the admin area of WordPress. When I saw: Events » Events Add-Ons » Filter Bar . . . it appears to be very much like what Cy (the client) is seeking. Is that correct? And if so, should he go ahead and purchase/download it? And also, if so, why wasn’t it suggested initially in this support request thread?

    Thanks in advance for sticking with me on this issue, and I look forward to some news that gets us a search/filter that adds 3 custom criteria!

    Steve

    #1293269
    Barry
    Member

    Hi Steve,

    Filter Bar does indeed an out-of-the-box means of filtering down the list of events and it includes support for filtering by organizer.

    And also, if so, why wasn’t it suggested initially in this support request thread?

    I guess because the initial request was couched in terms of completing some customization work that was already in progress.

    It’s not infrequent for users to prefer customizing what they already have over purchasing a separate plugin and indeed for this sort of thing in particular some site owners have a strong desire to modify or add extra controls to the existing search bar, versus adding a 2nd bar (which is how Filter Bar works).

    On review, though, we certainly could have flagged the possibility of you adopting Filter Bar and I apologize for not doing so.

    #1293334
    cyrilsack
    Participant

    OK, thanks Barry — much appreciated.

    Steve

    #1293737
    Barry
    Member

    Happy to help 🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘custom sorting of Events’ is closed to new replies.