You are here

function hook_autologout_prevent in Automated Logout 8

Same name and namespace in other branches
  1. 6.4 autologout.api.php \hook_autologout_prevent()
  2. 7.4 autologout.api.php \hook_autologout_prevent()

Prevent autologout logging a user out.

This allows other modules to indicate that a page should not be included in the autologout checks. This works in the same way as not ticking the enforce on admin pages option for autologout which stops a user being logged out of admin pages.

Return value

bool Return TRUE if you do not want the user to be logged out. Return FALSE (or nothing) if you want to leave the autologout process alone.

1 function implements hook_autologout_prevent()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

autologout_autologout_prevent in ./autologout.module
Implements hook_autologout_prevent().
1 invocation of hook_autologout_prevent()
AutologoutManager::preventJs in src/AutologoutManager.php
Determine if autologout should be prevented.

File

./autologout.api.php, line 21
Describe hooks provided by the autologout module.

Code

function hook_autologout_prevent() {

  // Don't include autologout JS checks on ajax callbacks.
  $path_args = explode('/', current_path());
  $blacklist = [
    'ajax',
    'autologout_ajax_logout',
    'autologout_ajax_set_last',
  ];
  if (in_array($path_args[0], $blacklist)) {
    return TRUE;
  }
}