I need to log a user out and redirect to a URL.
How would I do that in Drupal 7?
Thanks
You should call user_logout().
use this any where
 <?php
module_load_include('pages.inc', 'user');
user_logout();
?>
                        Another option is using the Rules module. You can set a rule up to redirect to a URL after a user logs out and various other rules if needed.
http://drupal.org/project/rules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With