How to programmatically log out a user in Drupal 7?

jini picture jini · Mar 30, 2012 · Viewed 11.2k times · Source

I need to log a user out and redirect to a URL.

How would I do that in Drupal 7?

Thanks

Answer

ceejayoz picture ceejayoz · Mar 30, 2012

You should call user_logout().