Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Logout Redirect setting effecting whole website
Avatar
James McShane
Rookie
Free Members
sp_UserOfflineSmall Offline
Aug 12, 2013 - 8:49 am

When a user logs out of the forum they get taken to an ugly "you are now logged out" page unless I specify a "Logout Redirect" value in Simple:Press -> Components. The problem I have is if I specify a logout redirect value (e.g. to the main Forums page) it's being used for all logout links on the website. So if a user logs out via a link at the footer of the main website, they are being taken to the Forums page instead of remaining on their current page but just not logged in any more.

Is this the way it's supposed to behave? Is there a way to stop this from happening?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 12, 2013 - 9:56 am

I guess the first thing to say is that the page with the 'you are now logged out' message is NOT coming from Simple:Press. I very much doubt it is coming from WordPress so I am guessing that this might be something coming from your WordPress theme - or perhaps another plugin if you have one installed pertaining to login/logout. At least that would be where I would look first. As far as I recall and my own tests show - when you log out of WordPress with no redirect in place it should take you back to the login form page.

The problem with the redirect is that using the WP API - and from my understanding of it -  the redirect needs to be sent with the logout link so I am unsure how other logout links on your site could be picking up the logout redirect set up in Simple:Press.

Steve... (Mr Papa): Do you concur wit what I have said here?

andy-signature.png
YELLOW
SWORDFISH
Avatar
James McShane
Rookie
Free Members
sp_UserOfflineSmall Offline
Aug 12, 2013 - 11:09 pm

With no redirect I get taken to the standard login form page with "you are now logged out" at the top, as you've said. But for some reason other logout links are picking up the redirect from Simple:Press.

If I remove the redirect from Simple:Press my footer logout link works fine; if I add a redirect to Simple:Press my footer logout link redirects to the same url as defined in Simple:Press. FYI, the logout link on the footer is as follows:

<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 13, 2013 - 1:44 am

how about you try this... in your spFunctions.php of your sp theme, add this:

add_filter('sph_logout_redirect', 'my_logout_check');
function my_logout_check($redirect) {
    $slug = sp_get_option('sfslug');
    if (strpos($_SERVER['HTTP_REFERER'], $slug) === false) {
        $redirect = '';
    }
    return $redirect;
}

and see if that helps you...

I think we used to only redirect on forum pages, but changed it after numerous requests to be site wide... if memory serves me correctly, first time some one did not want it so... 

 

Avatar
James McShane
Rookie
Free Members
sp_UserOfflineSmall Offline
Aug 13, 2013 - 7:18 am

Using the above code, the footer logout link is no longer taking me to the the forum logout redirect url which is good, however the new code seems to be still overriding the behaviour of my footer logout. I had set up the footer logout url to keep the user on their current page when logging out, and now they are getting sent to the standard WP login screen instead.

In any case it's not a major problem for me at this stage, I'm happy enough to send all users to the home page when they log out from either the forum or the footer link. (It just wasn't quite what I was expecting to happen, took me a bit by surprise.)

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Aug 13, 2013 - 1:08 pm

I guess rather than checking the referrer, you could check the redirect value itself...  and not affect the footer redirect...  since of course, the footer may be used on a forum page itself...  I assumed if you were on a forum page and you logged out, let the forum redirect win...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online: robwrp
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625