function smart_ip_set_user_data in Smart IP 6.2
Same name and namespace in other branches
- 6 smart_ip.module \smart_ip_set_user_data()
- 7.2 smart_ip.module \smart_ip_set_user_data()
- 7 smart_ip.module \smart_ip_set_user_data()
Set the $user data
Parameters
mixed $account: User account object.
array $location: User location data.
2 calls to smart_ip_set_user_data()
- smart_ip_set_location_data in ./
smart_ip.module - Set the user's location information
- 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 1033 - Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address
Code
function smart_ip_set_user_data($account, $location) {
smart_ip_update_fields($location);
// Determine if saving location details of visitor from EU countries are
// permitted.
$eu_visitor_dont_save = FALSE;
if (isset($location['is_gdpr_country'])) {
$eu_visitor_dont_save = variable_get('smart_ip_eu_visitor_dont_save', FALSE) && $location['is_gdpr_country'];
}
// Check if the user permitted to share location
$share_location = smart_ip_session_get('smart_ip_user_share_location_permitted', FALSE, TRUE);
if ($account->uid != 0 && $share_location && !$eu_visitor_dont_save) {
$user_obj = user_load($account->uid);
drupal_alter('smart_ip_user_save', $user_obj, $location);
user_save($user_obj, array(
'geoip_location' => $location,
));
}
}