You are here

function smart_ip_set_session_data in Smart IP 7

Same name and namespace in other branches
  1. 6.2 smart_ip.module \smart_ip_set_session_data()
  2. 6 smart_ip.module \smart_ip_set_session_data()
  3. 7.2 smart_ip.module \smart_ip_set_session_data()

Set the user's session information

3 calls to smart_ip_set_session_data()
smart_ip_admin_settings_submit in includes/smart_ip.admin.inc
Process Forms submitted by IP to Country administration page
smart_ip_set_location_data in ./smart_ip.module
Set the user's location information
smart_ip_user_presave in ./smart_ip.module
Implements hook_user_presave().

File

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

Code

function smart_ip_set_session_data($location) {

  // Store the location information in the session, merging any old data not overridden
  $smart_ip_session = smart_ip_session_get('smart_ip');
  if (isset($smart_ip_session['location'])) {
    $smart_ip_session['location'] = array_merge((array) $smart_ip_session['location'], $location);
  }
  else {
    $smart_ip_session['location'] = $location;
  }
  smart_ip_session_set('smart_ip', $smart_ip_session);
}