Hi,
I'm using the module to get the location of the user from the W3C look up and would like to fallback to a default zip code if the user rejects or the call fails. I'm using the following line to invoke it:
$location = ip_geoloc_get_visitor_location($menu_callback = 'ip-geoloc-current-location');
If the postal code on $location is available, I store that into a session variable and refresh my page with that zip code to populate my view's filter. If not, I'd like to use a default zip code instead .I'm wondering if there is a way(hook) that I can wait to see if HTML5 geo look up was unsuccessful or rejected by the user, then perform this condition?
Thank you!

Sam

Comments

safshar’s picture

Issue summary: View changes
rdeboer’s picture

Status: Active » Fixed

ip_geoloc_get_visitor_location() does not invoke the W3C lookup.

The W3C/HTML5 look up is an asynchronous call. When the HTML5 location comes in it gets posted to js/ip_geoloc/current_location. This URL is handled by ip_geoloc_current_location_ajax_recipient().
This then calls ip_geoloc_store_location, which provides a hook for you: hook_get_ip_geolocation_alter(&$location).
See ip_geoloc.api.php for details.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.