You are here

function _autologout_get_role_timeout in Automated Logout 7.4

Same name and namespace in other branches
  1. 6.4 autologout.module \_autologout_get_role_timeout()

Go through every role to get timeout value, default is the global timeout.

2 calls to _autologout_get_role_timeout()
AutoLogoutByRoleTestCase::testAutologoutTimeoutByRoleWhenRoleTimeoutIsLessThanStandard in tests/autologout.test
Check the role timeout has precedence over the basic timeout.
_autologout_get_user_timeout in ./autologout.module
Get a user's timeout in seconds.

File

./autologout.module, line 585
Used to automagically log out a user after a preset time.

Code

function _autologout_get_role_timeout() {
  $default_timeout = variable_get('autologout_timeout', 1800);
  $roles = user_roles(TRUE);
  $role_timeout = array();

  // Go through roles, get timeouts for each and return as array.
  foreach ($roles as $rid => $role) {
    if (variable_get('autologout_role_' . $rid, FALSE)) {
      $timeout_role = variable_get('autologout_role_' . $rid . '_timeout', $default_timeout);
      $role_timeout[$rid] = $timeout_role;
    }
  }
  return $role_timeout;
}