Home › Forums › Calendar Products › Events Calendar PRO › Map view load based on their location
- This topic has 5 replies, 3 voices, and was last updated 10 years, 3 months ago by
George.
-
AuthorPosts
-
December 22, 2015 at 8:42 am #1045438
dcantato
ParticipantWhere would I pass a variable for the users location to be automatically inserted so that the map would load events based on their location?
I can get their location with the api: freegeoip.net/json/
But I’m not sure where this would need to be passed through.
Could I just insert it into somewhere like this and have the lat and lng in the values on ready?
<div class=”tribe-bar-geoloc-filter”>
<label class=”label-tribe-bar-geoloc” for=”tribe-bar-geoloc”>Near</label>
<input type=”hidden” name=”tribe-bar-geoloc-lat” id=”tribe-bar-geoloc-lat” value=””>
<input type=”hidden” name=”tribe-bar-geoloc-lng” id=”tribe-bar-geoloc-lng” value=””>
<input type=”text” name=”tribe-bar-geoloc” id=”tribe-bar-geoloc” value=”” placeholder=”Location”>
<div id=”tribe-geo-options” style=”display: none;”><div id=”tribe-geo-links”></div></div></div>like:
$(‘tribe-bar-geoloc-lat’).value(‘userLat’)
$(‘tribe-bar-geoloc-lng’).value(‘userLng’)December 22, 2015 at 10:46 am #1045479George
ParticipantHey @dcantato,
There’s unfortunately not a simple or straightforward way to go about this sort of customization 🙁 It’d require some rather complex rewriting of aspects of our code, which is information I’m sorry to have to share!
If you’re not able to build this out yourself, I’d recommend hiring a professional developer like the ones we have listed here → http://m.tri.be/18k1
Cheers!
GeorgeDecember 22, 2015 at 11:08 am #1045496dcantato
ParticipantCan you point me in the direction of which files I should look over?
December 24, 2015 at 10:22 am #1046428dcantato
ParticipantI found what I think should be a good temporary solution if anyone else is looking for a quick solution:
$('#tribe-bar-geoloc').val('cityStateLoc') $(".tribe-events-button").click()If you call an api to get the users location and pass that into a city state variable called cityStateLoc you can have that called here and it will submit as if it was typed in.
It’s a temporary solution until I dig deeper but it works.
December 30, 2015 at 1:45 pm #1048264Brook
ParticipantHowdy Dcanto,
That’s a pretty good solution. There are two ways I personally would try to tackle this:
- HTTP Forward users to the location search URL. When you geocode the IP you will get back a lat, long, and name. Coincidentally our location searches need these three things, and append them to the URL:
example.com/events/?tribe-bar-geoloc-lat=51.5073509&tribe-bar-geoloc-lng=-0.12775829999998223&tribe-bar-geoloc=London%2C+UK
Using HTTP 302 redirects you could push users to the proper URL for location search in their area. - Using JS you can insert the name of their location and search the first result, as you have done.
Either way works! Let us know if you need anything else hear. As George said with this level of customization we’ll have to provide high level instructions and leave you or your developer to hash out the fine details. But we still love to help where we can. 🙂
Cheers!
– Brook
December 31, 2015 at 3:03 pm #1048615George
ParticipantI hope the (awesome!) code that Brook shared here helps @dcanto! For now, I will close up this specific thread. While we cannot help further with customizations, if any issues with the plugin arise open a new thread any time! 😀
Happy New Year,
George - HTTP Forward users to the location search URL. When you geocode the IP you will get back a lat, long, and name. Coincidentally our location searches need these three things, and append them to the URL:
-
AuthorPosts
- The topic ‘Map view load based on their location’ is closed to new replies.
