I have a request for 1 user only ($user->name) that after they leave a particular node/page ($node->title) that they be automatically be logged off of drupal. Leaving this page includes navigating to another page or closing the tab or browser window. How could the automatic logoff when leaving a page for a particular user and node/page combination be accomplished?

1 Answer 1


AFAIC you can get current node id from Drupal JS object. Having those id you can send Ajax request to Drupal which performs logout (http://api.drupal.org/api/drupal/modules!user!user.pages.inc/function/user_logout/7)

About JS events for this task you should look on other forurms


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.