Drupal: programmatically log out the user

/ Published in: PHP
Save to your folder(s)

**Important: this snipplet has moved to Github.**

- [Programmatically log out the user in Drupal](https://gist.github.com/1973079)

Copy this code and paste it in your HTML
  1. // Programmatically logs out the current user
  2. global $user;
  3. $tmp = NULL;
  4. user_module_invoke('logout', $tmp, $user);
  5. $user = drupal_anonymous_user();

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.