Logout redirect not working
-
Hi,
For some reason, I just cannot get the logout redirect to work – after logout, I always get dumped to https://www.mysite.com/wp-login.php?loggedout=true
I’ve tried setting this in the User Roles configuration and also put the redirect into the URL directly, but no luck. I’ve changed themes, deactivated plugins and set up Ultimate Members on a different site – all the same result.
Any help appreciated!
-
Hi @yosmc,
Please make sure you are using the latest version of the Ultimate member.
Check whether you have any caching active on your site or on your server e.g. Memcached or CloudFlare and try to exclude Ultimate member from caching.
You can also try to install our latest pre-released version of the plugin and see if it fixes your issues with redirection.
https://github.com/ultimatemember/ultimatemember/releases
Make sure to backup your site before installing pre-released version.Regards.
Hi and thanks for the reply,
Is there a changelog of some sort for the pre-release? If the issue is fixed, then obviously someone must have addressed it (don’t think it would somehow be fixed by “accident”).
Also, maybe you can confirm the problem? I mean it’s really just a click on the logout button, I’m very much assuming you have your own plugin installed as well.
Thanks!
Hi @yosmc,
We don’t have this issue on our test site and on several other sites where the Ultimate member plugin is installed.
Make sure that you are using yoursite/logout page and make sure it is assigned as logout page in Ultimate member -> Settings -> Setup.Regards.
That’s odd. What else can you recommend for trouble-shooting? Could the fact that I am using multisite has anything to do with it?
Maybe you can point me to the relevant code / file that is passing on the UM redirect, then I can look into it myself. At least as far as I know, what I am witnessing is the default WP behavior, so it seems like somehow the redirection induced by UM isn’t arriving where it should.
Thanks again
Speaking of odd… your claim that this is working on other (or even any other) site(s) is odd, too.
The culprit is the following lines in um-logout.php:
wp_logout(); session_unset(); exit( wp_redirect( um_user('logout_redirect_url') ) );
Strangely, various sources and help forums on the net claim that this can’t possibly work, as wp_logout() will already have dumped you on the standard WP login page, and the redirect simply won’t happen. Those same sources recommend to use the following, which works like a charm:
function auto_redirect_external_after_logout(){ wp_redirect( 'https://www.somesite.com' ); exit(); } add_action( 'wp_logout', 'auto_redirect_external_after_logout');
Hello ,
I have the same problem, the disconnection does not do. I created the logout page, linked the plugin to the page, but when I want to log out it displays a blank logout page.
Should we replace all the contents of the um-logout.php file with the code you recommended?
Can confirm. Logout redirects to wordpress’s logout page. @yosmc if you could add a little bit more detail to your fix that would be awesome. I tried replacing the snippet with your snippet, but it just lead to a blank logout page with no actions taken.
My apologies. I absolutely hate it when people post sloppy “solutions” on the Net that go with half-assed explanations which are comprehensible to nobody. ??
As for the original code, leave it untouched – don’t delete anything, and don’t replace anything. That also goes for the three lines which I called “the culprit” above – leave them where they are.
All you need to do is to ADD the five lines from the second box above (the stuff with auto_redirect_external_after_logout) somewhere to your code. Where and how you do that is a matter of taste. I assume it’ll work if you simply paste it at the end of um-logout.php – but no guarantee (just give it a try). If you do that, however, your changes might get overridden the next time you update Ultimate Member.
It’s better practice to put your custom code and functions somewhere where they are safe from automated updating. Here are your options:
https://www.skyverge.com/blog/add-custom-code-to-wordpress/
-
This reply was modified 6 years, 10 months ago by
yosmc.
Same issue for me now after updating to 2.0.4 version on 11/04/2018. Earlier it was working fine for us .
I tried the solution given above but no help.@plugin Author -Request you to please look in to this.
We are everytime getting redirected to
https://www.Oursite-Url.com/wp-login.php?loggedout=trueAye lads, just wanted to share my solution to this issue.
I created a test page and changed the UM default logout page to point to the newly created test page.
Tested to see if it works and it did. So I changed it back to the default UM logout page and it worked.
Honestly dunno why this worked but I think there must’ve been an issue with connecting the plugin to the logout page. Not sure if it’ll help you lads, but it worked for me.
Good luck!
Same issue here, on 5 sites, different hosts/plugins, etc…
3 sites were upgraded from previous UM versions, 1.n, and one had brand new 2.n UM version installed, and upgraded twice since.
Two sites are on CloudFlare, rest are not.
After logout, the user goes to the WordPress page on all sites on 2.n.
Creating a new logout page and changing it in UM settings did not work for us.Hi. I am also facing the same issue. When i logout from my website i also get logged out from wordpress. Any solution please
Is there any update on this?
We use the latest UM version and still get the WP logout page on multiple sites, multiple PHP versions (5.6 and 7.2). This was not the case before the 2.x update.
After logout, the user currently goes to: /wp-login.php?loggedout=true, instead of the pages specified in settings.Does everyone here have this resolved, or is this still an issue?
(Creating a new page and setting it as redirect destination as per daniel13 did not work for any of our sites.)-
This reply was modified 6 years, 1 month ago by
caycompass.
Hi everyone, any updates?
OMG, I’ve been trying to resolve this issue ALL DAY, and I finally found the problem … sharing here in case anyone else is having the same issue!!
It turned out that the login form (see Ultimate Member -> Forms -> Default login form) had been set to “Refresh Active Page” (in the options box, bottom right). This obviously overrides what you set in the individual User Role settings!
Going to bed now. Exhausted. Phew.
-
This reply was modified 6 years, 10 months ago by
- The topic ‘Logout redirect not working’ is closed to new replies.