You are here

function hook_get_ip_geolocation_alter in IP Geolocation Views & Maps 7

To hook in your own gelocation data provider or to modify the existing one.

Note that when IPGV&M calls this function the $location object may be partially fleshed out. If $location['ip_address'] is empty, this means that IPGV&M is still waiting for more details to arrive from the Google reverse-geocoding AJAX call. If $location['ip_address'] is not empty, then IPGV&M does not expect any further details and will store the $location with your modifications (if any) on the IP geolocation database. You must set $location['formatted_address'] in order for the location to be stored.

Parameters

array $location: The location to alter.

3 invocations of hook_get_ip_geolocation_alter()
ip_geoloc_get_location_by_ip in ./ip_geoloc_api.inc
Returns the location details associated with the supplied IP address.
ip_geoloc_requirements in ./ip_geoloc.install
Implements hook_requirements().
ip_geoloc_store_location in ./ip_geoloc_api.inc
Store the supplied IP geolocation info on the database.

File

./ip_geoloc.api.php, line 27
Hooks provided by "IP Geolocation Views & Maps" (ip_geoloc).

Code

function hook_get_ip_geolocation_alter(&$location) {
  if (empty($location['ip_address'])) {
    return;
  }
  $location['provider'] = 'MYMODULE';

  // ....
  $location['city'] = $location['locality'];
}