Support » Plugin: WP Store Locator » Make the plugin wait to get users location before showing default results

  • Resolved JFrankParnell


    Yes, I have the ‘show all locations’ off, but I mean, can you make it so that the results for the default location do not show until the users’ location fails/declines?

    Presently, it seems to load the default location’s results, then gets the user’s location, then loads a new set of results. I dont want to see any results until either I accept the browser location prompt or if that is declined or fails, show me the default, then I can put in my current location.

    And really, I guess that it should be an option to show the default results at all. An option to wait for either browser location or manual input to show anything. Although, in that case, the ‘show all’ option should still work on the map, but not the results list. In this case, you’d get the map, with all the pins but nothing in the list until browser/manual location has been specified.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tijmen Smit


    What happens now is that if the user doesn’t approve the location request after 3 sec it starts to load the store data, but it makes sense to change how to works. 3 sec is a bit to short now that I think of it. I will in one of the next versions make it an option to define the timeout time in the settings before the loading of store data is triggered.

    You can manually change the timeout value in the /js/wpsl-gmap.js file, then search for ‘function checkGeolocation’ and change the 3000 into whatever value you want. ( 3000 = 3sec ).

    Ok, thanks. By putting in some large number, I can effectively not let it load any results until it gets a browser/manual location.

    I had originally wanted this to avoid user confusion about results lists populating then re-populating. But, this is also good because then I am hitting the google api less (by half) and not running out of free api hits.

    Plugin Author Tijmen Smit


    If you remove these lines completely from the ‘checkGeolocation’ function then it should just wait until the user approves it ( didn’t test it ).

    locationTimeout = setTimeout( showStores, 3000 );
    clearTimeout( locationTimeout );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Make the plugin wait to get users location before showing default results’ is closed to new replies.