You are here

function is_user_debug_mode in Smart IP 7.2

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

Check if the current user is in debug mode.

Parameters

int $uid: User ID.

Return value

bool TRUE if the current user is in debug mode and FALSE if not.

1 call to is_user_debug_mode()
device_geolocation_get_coordinates in modules/device_geolocation/device_geolocation.module
Get Visitor's coordinates.

File

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

Code

function is_user_debug_mode($uid = NULL) {
  global $user;
  $in_debug_mode = FALSE;
  $current_user = $uid ? user_load($uid) : user_load($user->uid);
  $roles_debug = variable_get('smart_ip_roles_in_debug_mode', array());
  foreach ($current_user->roles as $role_id => $role) {
    if (isset($roles_debug[$role_id]) && $roles_debug[$role_id]) {
      $in_debug_mode = TRUE;
      break;
    }
  }
  return $in_debug_mode;
}