WP Geo
Add user geolocation (4 posts)

  1. Stefano Colarelli
    Posted 3 years ago #

    I love this smart plugin.
    I would like to share a small hack to display the user position in the widget map (contextual or category map). I edited wpgeo-widget.php, inside the folder '/widgets', and I add this code

    if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
    var latitude = parseFloat( position.coords.latitude );
    var longitude = parseFloat( position.coords.longitude );
    marker'. count( $coords ) .' = wpgeo_createMarker(new GLatLng(latitude,longitude), ' . $icon . ', "You", "#");
    //recalculates center and zoom level of the map
    var center = bounds.getCenter();
    var zoom = map.getBoundsZoomLevel(bounds)
    if (zoom > ' . $args['zoom'] . ') {
    zoom = ' . $args['zoom'] . ';}
    map.setCenter(center, zoom); }); }

    in js function createMapWidget(), under
    '.$markers_js .'

    I hope it can be a useful starting point!


  2. Ben Huson
    Plugin Author

    Posted 3 years ago #

    Thank you, I like your suggestion.
    I'll try to get an option for it added in a future version or hooks so it can be created as a separate plugin.

  3. martinbeaulne
    Posted 3 years ago #

    I've been looking for soooo long for a plugin that can sort members by distance on a member search page...

    This plugin seems capable of creating a position database for each member.... it would be easy, after that, to sort members by distance...

    Is it possible for you to develop such a plugin ?

  4. Ben Huson
    Plugin Author

    Posted 3 years ago #

    This plugin does not currently allow you to save a location for users but I may try to add this functionality to a future version.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Geo
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.