At present, if you logout from Drupal, you are redirected to the Home page, but with no notification or message to say that you have logged out.

Is it possible to override the logout functionality so that it redirects you back to the user/login form, and additionally see that the user has logged out and add some text above the standard login form such as:

"You have signed out successfully"

I've had a good look around, and Automatic Logout seems to have a popup when a user is logged out, but then I don't want the automatic logout functionality :-)

Any help is really appreciated, thanks!

Comments

sunset_bill’s picture

I'm doing something a little different on logout, namely redirecting the user to the page they were on when they logged out, like so

l('Log out', 'logout', array(), drupal_get_destination()) 

Changing the drupal_get_destination() call to the page you want to redirect to should do it.

I don't know how to tell if someone's just logged out. I'm using a customized login block per http://drupal.org/node/19855, with a backup logged-in block that displays when a user is logged in. When they log out, the logged-in block goes away and is replaced by the login form, and that's the indicator.

HTH,
Bill

druvision’s picture

Works great for me. Also I add rel=nofollow by using the following code inside the block:

print l(t('Log out'), 'logout', array('rel' => 'nofollow'), drupal_get_destination());
creazion_dev’s picture

Or you can use the following tip: http://drupal.org/node/363481#comment-2847976

davidhernandez’s picture

You could also do this with an action and trigger. You create a 'redirect url' action and assign it to the trigger 'user logs out'. I believe you can also set a message.

asb’s picture

@davidhernandez: I don't have a 'user logs out' trigger at ./admin/build/trigger/user. There is only 'Trigger: After a user has logged out', and this trigger doesn't allow to select a 'Redirect to URL' action (Drupal 6.20).

davidhernandez’s picture

You are correct. Redirect to Url is not available for user has logged out. I don't know why. You could try the Rules module.

mcfilms’s picture

There is a parallel thread about this right now:
http://drupal.org/node/768768

A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com