You are here

function _autologout_user_in_by_user_role in Automated Logout 7.2

Same name and namespace in other branches
  1. 5 autologout.module \_autologout_user_in_by_user_role()
  2. 6 autologout.module \_autologout_user_in_by_user_role()
  3. 6.2 autologout.module \_autologout_user_in_by_user_role()
2 calls to _autologout_user_in_by_user_role()
autologout_form_user_profile_form_alter in ./autologout.module
Implements hook_form_FORM_ID_alter().
autologout_user_update in ./autologout.module
Implements hook_user_update().

File

./autologout.module, line 469
Used to automagically log out a user after a preset time, AjK May 2006

Code

function _autologout_user_in_by_user_role($passed_user = NULL) {
  global $user;
  if ($passed_user === NULL) {
    $local_user = $user;
  }
  else {
    $local_user = $passed_user;
  }

  // some modules invoke hook_user without fully loading the $account object
  // we may be able to remove this if those modules are fixed.
  if (!is_array($local_user->roles)) {
    return FALSE;
  }
  foreach (user_roles(TRUE) as $role) {
    if (_autologout_local_settings($role) == 2 && in_array($role, array_values($local_user->roles))) {
      return TRUE;
    }
  }
  return FALSE;
}