civicrm_autologout_bridge
If you use CiviCRM alongside Drupal's Automated Logout module, you may have noticed that users get logged out unexpectedly while actively working in CiviCRM. This happens because CiviCRM's interface is heavily AJAX-driven — navigating between screens, opening popups, submitting forms, and using search all happen without triggering a standard Drupal page request. The Automated Logout module never sees this activity, so it counts the user as idle and ends their session.
The CiviCRM Autologout Bridge solves this by detecting the three types of activity that the Automated Logout module cannot see on its own — CiviCRM AJAX navigation, scrolling, and touch input — and reporting each one as activity, keeping the session alive for as long as the user is genuinely working.
No configuration is needed. Install the module and it works automatically for all authenticated users on CiviCRM pages.
Features
- CiviCRM AJAX navigation detection — Every time CiviCRM loads new content via AJAX (opening a popup, submitting an inline edit, navigating via a menu link, loading a form), the bridge intercepts Drupal's
attachBehaviors()call and signals activity. - Scroll detection — The
scrollevent does not bubble, so the Automated Logout module cannot watch it directly. A user reading a long contact list or activity feed with no mouse movement would otherwise time out; the bridge catches this. - Touch input detection — For mobile and tablet users,
touchstartdoes not always generate a correspondingmousemoveevent. The bridge handles this gap. - Debounced signals — Activity signals are throttled to once every 5 seconds by default, preventing excessive server requests while still keeping sessions reliably alive.
- Zero configuration — No settings page, no content types, no text format changes. Enable and go.
- Lightweight — A single small JavaScript file, attached only to pages where CiviCRM is active for authenticated users.
Post-Installation
There is nothing to configure. Once the module is enabled, it attaches its JavaScript automatically to all CiviCRM pages for authenticated users. There is no settings page, no permissions to assign, and no content types or fields added to your site.
To verify the bridge is working after installation, open a CiviCRM page, open your browser's developer console, and run:
document.body.addEventListener('preventAutologout', () => console.log('bridge signalled'));Then scroll the page or trigger any CiviCRM AJAX action such as opening a popup or submitting an inline edit. You should see bridge signalled appear in the console within 5 seconds.
If you need to adjust the debounce interval, change the SIGNAL_INTERVAL constant in js/civicrm_autologout_bridge.js. This is the only tunable parameter.
Additional Requirements
- Automated Logout module (2.x or later) — this module extends Autologout's own session-keeping mechanism and requires it to be installed and configured.
- CiviCRM installed with Drupal integration.
- Drupal 10.3 or Drupal 11.
Recommended modules/libraries
No additional modules are needed beyond the requirements above. The Automated Logout module's own configuration (timeout duration, logout redirect, cross-tab cookie synchronisation) applies as normal and is the right place to tune session behaviour.
Similar projects
The Automated Logout module itself already listens for mousemove, keyup, and Drupal's formUpdated events on document.body, and these do bubble up from CiviCRM content. This module does not replace or duplicate any of that — it exclusively fills the three gaps that Autologout cannot cover: CiviCRM AJAX navigation events, scroll events, and touch events. If you are not running CiviCRM, you do not need this module.
Supporting this Module
This module is developed and maintained by enCircle Solutions, a UK-based CiviCRM and Drupal consultancy specialising in NHS, government, and third-sector clients. It was created to solve a real problem encountered in production deployments of the TrustCRM managed platform for NHS Foundation Trusts and is contributed back to the community as open source.
If this module saves you time, consider donating to the Drupal Association to support the infrastructure that makes projects like this possible.
Community Documentation
The GitHub repository contains the full README, including a verification checklist and notes on cross-tab behaviour. Bug reports and patches are welcome via the Drupal.org issue queue.