Page 1 of 1

redirect logged in users

PostPosted: March 8th, 2011, 3:24 pm
by gvdsleen
Redirection of logged in users to a specific page using /page-%%current_user_level%% stopped working after upgrade to newest version.

Have done everything I can think off, including disabling all plugins and roll-back to previous version. Am i missing something? Tips to solve this?

Re: redirect logged in users

PostPosted: March 9th, 2011, 12:26 am
by Cristián Lávaque
Did you use /page-%%current_user_level%% or a full URL starting with http://?

It should be the latter. :)

Re: redirect logged in users

PostPosted: March 9th, 2011, 4:46 am
by gvdsleen
Issue was in using the sidebar login widget. Have upgraded to pro and am now using the S2member widget.

However, I would like to change the link to the profile page from a pop-up to the Buddypress profile page.

Changing the edit profile link in the widget does not seem to work. Changed it to the URL:

http://www.mysite.com/members/%%current_user_login%%/profile.

Suggestions?

Re: redirect logged in users

PostPosted: March 9th, 2011, 10:16 am
by mctwisty
Redirection is not working for me either. Trying a custom URL or just choosing a page doesn't work. Please help. My users are confused.

Re: redirect logged in users

PostPosted: March 9th, 2011, 11:21 am
by Cristián Lávaque
gvdsleen wrote:Issue was in using the sidebar login widget. Have upgraded to pro and am now using the S2member widget.

That's good to know in case someone else has the same problem. Thanks!

Re: redirect logged in users

PostPosted: March 9th, 2011, 11:29 am
by camillemm
Well, it's not a great solution as the Non pro version prevent the redirection (and even with plugins created for redirecting visitors).

Re: redirect logged in users

PostPosted: March 9th, 2011, 2:09 pm
by gvdsleen
Would like to know how to redirect users to their buddypress profile page from the sidebar widget?

Re: redirect logged in users

PostPosted: March 9th, 2011, 4:36 pm
by camillemm
No, just a simple redirection after login on a regular blog. I found a solution but not very "clean".

Re: redirect logged in users

PostPosted: March 9th, 2011, 6:18 pm
by Cristián Lávaque
camillemm wrote:No, just a simple redirection after login on a regular blog. I found a solution but not very "clean".

Did s2Member's post-login redirection not work for you?

WP Admin -> s2Member -> General Options -> Login Welcome Page

Re: redirect logged in users

PostPosted: March 10th, 2011, 2:46 am
by camillemm
OK, found the problem (an hidden redirect field breaking the redirection) ! :oops:

Re: redirect logged in users

PostPosted: March 10th, 2011, 3:38 am
by Cristián Lávaque
I'm glad you solved it!

Where was that hidden redirect? Just curious.

Re: redirect logged in users

PostPosted: March 10th, 2011, 4:39 am
by camillemm
Well here is the story:

I selected for redirection http://www.mysite.com/%%current_user_login%%
I put a login code like this

Code: Select all
<<?php if (!(current_user_can('level_0'))){ ?>
<h2>Login</h2>
<form action="<?php echo get_option('home'); ?>/wp-login.php" method="post">
<input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="20" />
<input type="password" name="pwd" id="pwd" size="20" />
<input type="submit" name="submit" value="Send" class="button" />
    <p>
       <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label>
       <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
    </p>
</form>
<a href="<?php echo get_option('home'); ?>/wp-login.php?action=lostpassword">Recover password</a>
<?php } else { ?>
<h2>Logout</h2>
<a href="<?php echo wp_logout_url(urlencode($_SERVER['REQUEST_URI'])); ?>">logout</a><br />
<a href="http://XXX/wp-admin/">admin</a>
<?php }?>


It worked nice until WP 3.04. So I looked on this forum and searched for login codes but nothing worked nice. So I used redirection plugins (Peter's Login redirection) but with WP 3.05 even these plugins stopped to work in conjunction with S2member.
At last, I changed the hidden redirection with

Code: Select all
<input type="hidden" name="redirect_to" value="<?php global $current_user;
      get_currentuserinfo();
     echo $current_user->user_login;

?>" />

and I managed to redirect people to their page. The last thing I did is to delete this hidden redirection and it seems to work with S2member feature.

Re: redirect logged in users

PostPosted: March 10th, 2011, 4:49 am
by Jason Caldwell
Thanks for the excellent question.
gvdsleen wrote:Issue was in using the sidebar login widget. Have upgraded to pro and am now using the S2member widget.

However, I would like to change the link to the profile page from a pop-up to the Buddypress profile page.

Changing the edit profile link in the widget does not seem to work. Changed it to the URL:

http://www.mysite.com/members/%%current_user_login%%/profile.

Suggestions?

Couple of things on this topic.
1. If you are using the s2Clean theme, please remember that s2Clean comes with two variations of your Sidebar and Footbar. So perhaps you are editing the one for public view ( i.e. the default Sidebar ), and actually testing while logged-in ( i.e. you might be seeing the other variation ). In other words, you have to edit both Sidebar/Widget variations if you're doing it this way with the s2Clean theme.

2. In the current version of s2Member Pro ( at this time: v1.5.2 ), those %%current_user_xxxx%% Replacement Codes are not supported by that field in the widget panel. I'm having this updated for you in the release of s2Member Pro v1.5.3+.

Re: redirect logged in users

PostPosted: March 10th, 2011, 4:09 pm
by Vinnyo
This is exactly the same problem I am having.

Which file did you edit and input the code you mentioned


Thanks
Vince

Re: redirect logged in users

PostPosted: March 10th, 2011, 4:23 pm
by Cristián Lávaque
It'll vary depending on what is modifying the login form.

You can try deactivating the other plugins one by one until you see this change in your login form, then you'll know which one is doing it.

Or you can view the HTML source code of your login page and find the hidden redirection field. Copy it and search your WordPress source files, and its plugins', to see if you find which one is adding it.

Re: redirect logged in users

PostPosted: March 10th, 2011, 4:33 pm
by camillemm
Vinnyo wrote:This is exactly the same problem I am having.

Which file did you edit and input the code you mentioned


Thanks
Vince

As I created myself the login form, I knew where to search :-)

Re: redirect logged in users

PostPosted: March 15th, 2011, 8:06 am
by gvdsleen
Hi Jason,

GREAT! thanks for the update, is working like a charm now!

Re: redirect logged in users

PostPosted: March 15th, 2011, 2:58 pm
by Jason Caldwell
Thanks for the follow-up. You're very welcome!
gvdsleen wrote:Hi Jason,

GREAT! thanks for the update, is working like a charm now!

In the current version of s2Member Pro ( at this time: v1.5.2 ), those %%current_user_xxxx%% Replacement Codes are not supported by that field in the widget panel. I'm having this updated for you in the release of s2Member Pro v1.5.3+.
This was implemented in the release of s2Member Pro v1.5.3+.