How to programmatically log out in Drupal 7?

I need to register a user and redirect the URL.

How do I do this in Drupal 7?

thanks

+7
source share
3 answers

You must call user_logout() .

+17
source

use it somewhere

  <?php module_load_include('pages.inc', 'user'); user_logout(); ?> 
+4
source

Another option is to use the rule module. You can set the rule before redirecting to the URL after the user logs out and, if necessary, use other other rules.

http://drupal.org/project/rules

+1
source

All Articles