You are here

function _autologout_exclude_by_role in Automated Logout 6.2

_autologout_exclude_by_role()

Is the user in a role that we exclude from features defined by this module

Parameters

$account: A drupal "user" object or default FALSE (use global $user)

Return value

bool TRUE if user to be excluded, FALSE otherwise

2 calls to _autologout_exclude_by_role()
autologout_block in ./autologout.module
Implementation of hook_block().
autologout_init in ./autologout.module
Implementation of hook_init().

File

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

Code

function _autologout_exclude_by_role($account = NULL) {
  global $user;
  if ($account == NULL) {
    $account = $user;
  }
  foreach (user_roles(TRUE) as $role) {
    switch (_autologout_local_settings($role)) {
      case 0:

        // Enforce for all in this role
        break;
      case 1:

        // Exclude all users in this role
        if (in_array($role, array_values($account->roles))) {
          return TRUE;
        }
        break;
      case 2:

        // Exclude user if user set to disable
        if (in_array($role, array_values($account->roles))) {
          if ($account->autologout == 1) {
            return TRUE;
          }
        }
        break;
    }
  }
  return FALSE;
}