How to Automatically pull user location into Filter Bar

Home Forums Calendar Products Filter Bar How to Automatically pull user location into Filter Bar

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1191699
    Mike
    Participant

    I have seen plenty of websites where the user is asked to provide their location automagically (based off their IP, I am sure). I would love to add this feature, and pass on the information to the Event Calendar plugin, so that it automatically shows the events close to the user.

    How can I grab this data and feed it into the Filter bar?

    #1192116
    Andras
    Keymaster

    Hello Mike,

    Thanks for reaching out with your question. A really good one!

    Unfortunately this is not a feature available out of the box, but I believe it could be done somehow.

    First I would get a plugin that can do geolocation, something like this.

    Then most probably I would add the location to the search bar with some jQuery.

    Does this help you get started?

    Cheers,
    Andras

    #1192118
    Andras
    Keymaster

    By the way, if you think that is something you would like as a feature I encourage you to visit our User Voice Page and either upvote an existing request or make a new request there.

    A.

    #1192137
    Andras
    Keymaster

    I was a bit curious so I experimented a bit. This is not a full fledged solution, as I don’t have time for that now, but should get you started.

    1. Get the lite plugin I mentioned above. That will get you as far down as country. If you want to go to city level, then you will wither need a different free plugin, or you can get the pro version of that one.
    2. Make sure that jquery is loading on the calendar views where there is a search bar. (The function tribe_is_view should help.)
    3. This snippet should then add the country to the search bar location, BUT doesn’t do the searching yet. I’ll let you figure that out.

    <script type='text/javascript'>
    $( function () {
    $('#tribe-bar-geoloc').val("<?php echo geot_country_name() ?>");
    });
    </script>

    Hope this further helps.

    Cheers,
    Andras

    #1202077
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How to Automatically pull user location into Filter Bar’ is closed to new replies.