You are here

function smart_ip_delete_location_data in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 smart_ip.module \smart_ip_delete_location_data()

Delete the $user data

1 call to smart_ip_delete_location_data()
smart_ip_update_user_location in ./smart_ip.module
Update user's location only if the IP address stored in session is not the same as the IP address detected by the server or debug mode IP.

File

./smart_ip.module, line 1162
Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address

Code

function smart_ip_delete_location_data() {
  global $user;
  if ($user->uid != 0) {
    $user_obj = user_load($user->uid);
    unset($user_obj->data['geoip_location']);
    smart_ip_session_set('smart_ip', NULL);
    if (module_exists('device_geolocation')) {
      smart_ip_session_set('device_geolocation', NULL);
    }
    drupal_alter('smart_ip_user_delete', $user_obj);
    user_save($user_obj);
  }
}