I'd like to be able to provide the URL end users will reach after logging out instead of my domain being the default and only option www.mysite.com
I'd like to be able to provide the URL end users will reach after logging out instead of my domain being the default and only option www.mysite.com
Comments
Comment #1
francewhoaWith Drupal 5.7 adapt then use the following link:
http://www.example.com/logout&destination=node/mylogoutpage
This link do a log out then redirect to the page "mylogoutpage".
On your site, replace "www.example.com" with your domain and change the "node/mylogoutpage" with the path of your goodbye page.
If you use menus disable the default "logout" link in Admin --> Menus and then manually create a link somewhere on your site that uses the above link.
Source: http://drupal.org/node/120253
Comment #2
tcconway commentedThis feature doesn't accept third party urls. I'd like to do something like:
http://www.example.com/logout?destination=http://www.another-site.com/?v...
Possible? when I try that example on my site, It just goes to http://www.example.com/www.another-site...etc
Any ideas?
Thanks!
Comment #3
sid3000 commentedmodify the drupal_goto() function!
Comment #4
tcconway commentedThanks sid. I'll have a look.
One more question, if you don't mind:
Is there a way to set up a custom logout? Not my altering core, but maybe in template.php or something?
I'd like to do a bit of php code during the logout process. My install ties into a custom login process, and when a user clicks a logout link, I have to do a couple of database calls, update a few session variables in addition to logging out of drupal.
Any way to have a custom function somewhere, where I could do something like this, without altering core?
TIA
Comment #5
sid3000 commentedplease check the links below.
http://drupal.org/node/203538
http://drupal.org/node/120253
Comment #6
abramo commentedMay be you want to try the following code, simple and effective:
Many thanks to Nils (suit4) who provided the code.
.
Comment #7
willmoy commentedYou can get a logout to redirect to a page on your site without any code. In D7 enable menu module, go to admin/structure/menu, and in the user menu disable the logout link, and replace with a custom link to user/logout?destination=node/10 or whatever.
However, if you wish this to redirect to an external site, no dice. user_logout() calls drupal_goto() which only redirects internally.
Therefore, valid feature request. The open redirect concern doesn't apply here because you have to be logged in to reach user/logout.
But, this request depends on drupal_goto supporting external urls #337261: parse_url in drupal_goto breaks destination url.
Comment #8
canyonbreeze commentedHere is what I did that seems to work. Create a page using input format php and put in the following code. Assign the menu link to the page before saving. When you save the page you are logged out so you will have to re-login. I have to delete the page and recreate it to edit is well or it logs out before I can edit. No big deal I just keep the code in a text file.
[code]
[/code]
Comment #9
canyonbreeze commentedThis board messed up the last line trying to resolve the link or something. See php headers command for proper syntax. This doesn't seem to clear out the cache correctly on all browsers so needs some work.