Redirect on logout

Professional social WordPress theme with metro design, fully-adjustable grid widget and BuddyPress support.
GK User
Sat Apr 12, 2014 1:22 pm
Hello,

I have the (M) Social theme installed, and my activity and directory areas are all hidden and can only be seen when logged in. So, when a user logs out when they are on one of these pages they of course get a "404" error page not found. I'd like to change it to when they logout it redirects to the home page. I don't really want to tie it to a specific button because there are multiple ways to logout.

Is there a way to add this redirect to the logout functionality across the theme?

Thanks.
User avatar
Fresh Boarder

GK User
Sat Apr 12, 2014 4:54 pm
User avatar
Moderator

GK User
Wed Apr 16, 2014 2:57 am
Hi @Cyberek

It doesn't seem to work for me on the pages that are login-restricted.

I put the following in my functions.php file:

Code: Select all
// redirects to homepage after logout
add_action('wp_logout','go_home');
function go_home(){
  wp_redirect( home_url() );
  exit();
}


If I'm in an activity thread or the directory or groups or any page that I have listed as must be signed-in to view I get this when I hit the "Logout" button in the menu bar that is part of your theme.

This is the url that shows up: https://briarcliffcommunityalliance.org ... tion=login

Image URL: https://qsnapnet.com/snaps/fuc493w93eszia4
User avatar
Fresh Boarder

GK User
Thu Apr 17, 2014 1:44 pm
This is standard wordpress bevahe. Could you check if with default theme it behaves same?
User avatar
Moderator

GK User
Thu Apr 24, 2014 1:42 am
I tried this on my test site and it worked fine. I believe it is related to SSL that I have implemented on the site that is having issues. Is it common for SSL to cause issues with WordPress functions and plugins?
User avatar
Fresh Boarder

GK User
Fri Apr 25, 2014 2:14 pm
That is why I have asked you to test the solution on default WP theme. I'm not familiar with this kind of issues on certified sites but perhaps redirect solution itself doesn't work with ssl somehow.
While this is not a standard WP solution, nor our template one, I can't help much more.
User avatar
Moderator

GK User
Sun Apr 27, 2014 2:25 am
Well, it didn't work on the default WP theme either. I did figure it out though, I had to update the login url in the settings. It seems to work now.
User avatar
Fresh Boarder

GK User
Mon Apr 28, 2014 4:03 pm
Where exactly have you set the login url up?
User avatar
Moderator

GK User
Wed Apr 30, 2014 3:14 am
In the MSocial Template Options > Features. Also, I had my blog set as http instead of https, but I think that was another issue.
User avatar
Fresh Boarder

GK User
Fri May 02, 2014 6:42 pm
Ok, thanks for sharing the solution.
User avatar
Moderator


cron