Page 2 of 2

Re: Login Redirect Not Working - Need Help Fast

PostPosted: March 31st, 2011, 3:20 am
by Jason Caldwell
Thanks Vince. I got your email. I just took another look at your site. That hidden redirect_to variable is still in your site. You might take another look at your theme files and make sure you've removed all occurrences of that variable. Also, be sure that you reset any WordPress® caching plugins after making those changes. For instance, if you're running Super Cache or Quick Cache, please clear your cache after making theme changes.

Re: Login Redirect Not Working - Need Help Fast

PostPosted: March 31st, 2011, 4:12 pm
by Vinnyo
Hey Jason,

Ooops I forgot to mention that I did a backup and of course that redirect reappeared. However I did remove this before and nothing had changed. I will remove it again and check any plugin cache settings but I don't think I have any plugins that have a cache file.

I will post back again once I have cleared that redirect.

Thanks
Vince

PS ----Wordpress has a hidden login redirect form in the wp-login.php file. Should that be removed as well?

Re: Login Redirect Not Working - Need Help Fast

PostPosted: March 31st, 2011, 8:54 pm
by Jason Caldwell
Oh, I'm glad you brought this up.
Wordpress has a hidden login redirect form in the wp-login.php file. Should that be removed as well?

No, references to the `redirect_to` variable inside the `/wp-login.php` file should remain.

This is where the `redirect_to` variable is actually implemented, and we don't want to disable the functionality all together; just in case you ever need it for a useful purpose. For example, WordPress itself uses this in several places within your Dashboard, which is a good thing. This only gets in the way when it's used on login forms on the front-end of your site; causing clashes with your Login Welcome Page.

Re: Login Redirect Not Working - Need Help Fast

PostPosted: March 31st, 2011, 10:32 pm
by Vinnyo
Hey Jason,

Good news, bad news...OK so the redirect is working...yes it is working but only for "subscribers" and not for users who have the "S2member LEVEL 1" access. This is the setting for all paying users so they are still being redirected to the wp-admin area. I checked the S2member settings but don't see where I can correct this.

We are close!

Talk to you soon

Thanks
Vince

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 1:32 pm
by Jason Caldwell
Hi Vince. Thanks for the follow-up.
Have you modified any of your s2Member Roles?
s2Member will not redirect Users/Members who have the ability to "edit_posts".

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 6:57 pm
by Vinnyo
Hey Jason,

OK well this makes sense then. However I need to have my users be able to edit posts..is there a way to allow the redirect and allow users to edit posts.

Basically is there some code I can delete or remove to allow this to happen on both ends.


Thanks
Vince

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 7:15 pm
by Cristián Lávaque
To have the redirection work with members that can edit posts, I've found that adding redirect_to to wp-login.php's URL works. Like this:

http://yoursite.com/wp-login.php?redirect_to=/the-page-you-want


That will also redirect you when you login from there, but that'd be a minor inconvenience if it solves the problem for the rest of the users, I imagine.

I hope that helps. :)

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 7:37 pm
by Vinnyo
Hey thanks for the response,

The thing is I still need to access the wp-admin area so I can review posts and approve them or not.

By the sounds of it the code below will redirect me to the same page my users are going???? If that is the case that may not work for me.

See what is suppose to happen is users login to the page I have been trying to redirect to....from there they get all the info they need and learn how to use the system. On that page I have a redirect link that allows users to go to the backend or wp-admin area were they can add posts, edit posts and more.

I have a link in the wp-admin area that goes to the frontend page I have been having redirect issues with but I prefer people to go to this page first.

So basically my users can go from a frontend page to the backend (wp-admin) area without issue. This was working but with the latest updates this is not the case.


The problem is close to being resolved...real close :)

Thanks
Vince

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 7:44 pm
by Cristián Lávaque
Well, with what I suggested, you'd be redirected to that page after you login, but nothing stops you from getting to the dashboard with one click on its link.

Let me see if I understand:

The problem is that your users can't go to the admin area? Even if the click on the link to it? If that's the case, then it may be a problem with their role setting, where WP doesn't believe they should be there.

What plugin are you using to give them edit priviledges? If they had that, they should be allowed into the backend.

If they have the priviledge to get back there, WP would normally redirect them there after login, which is what I know understand you want. Is that it?

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 8:00 pm
by Vinnyo
Hey Cristián,

No, I still have access to the wp-admin area. So do my users. The main problem is that instead of going to
www.linkamotion.com/welcomepageexample, users were going straight to the WP-admin area. They need to go to this area and be able to perform duties to write posts and publish those posts. All of this still works. I am using a capabilities plugin. I just wanted them to go to my welcome page first and from there I have provide a link on that page to go to the wp-admin area.

However...the reason why the redirect in S2member is not working for users who have a S2member level 1is because according to Jason if the user has the ability or capability to "edit posts" then S2member does not redirect to the www.linkamotion.com/welcomepageexample.

Now you mentioned that code above could solve all these issues. If that is the case were roughly in the wp-login.php file do I insert it. I would like to give it a try and see how if this will solve the issue.

Thanks for your help I appreciate it.

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 9:19 pm
by Cristián Lávaque
Yeah, then my reply above is correct viewtopic.php?f=4&t=2642#p8902

You'd add it to the links that point to the wp-login.php page. What is the URL to your login page? Add ?redirect_to=/welcomepageexample and see if it works after you log in. ;)

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 10:01 pm
by Vinnyo
Wicked I will give it a try. Any advice on which line # in the wp-login file that I should add that code?

I am looking through it now.

Thanks
Vince

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 10:15 pm
by Vinnyo
Never mind I got it! Thankfully....Thanks Cristián and Jason.

It seems there was a combination of problems..one effecting another but you guys helped and it now works ;)


Thanks a bunch

Vince

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 2nd, 2011, 10:44 pm
by Cristián Lávaque
Great! I'm glad you solved it. :D

Re: Login Redirect Not Working - Need Help Fast

PostPosted: April 3rd, 2011, 1:14 pm
by Jason Caldwell
Vinnyo wrote:Hey Jason,

OK well this makes sense then. However I need to have my users be able to edit posts..is there a way to allow the redirect and allow users to edit posts.

Basically is there some code I can delete or remove to allow this to happen on both ends.


Thanks
Vince

Yes, it is also possible to do this.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter
("ws_plugin__s2member_login_redirect", "__return_true");
?>
* This forces a redirection to your Login Welcome Page, for everyone; regardless.

Or, if you want to get more specific, do something like this.
Code: Select all
<?php
add_filter 
("ws_plugin__s2member_login_redirect", "my_function", 10, 2);
function my_function ($filter, $vars = array ())
    {
        if ($vars["user"]->has_cap ("s2member_level1"))
            return true;
        /**/
        else return $filter;
    }
?>
* This forces a redirection to your Login Welcome Page, for Level #1 Members,
even if they have the ability to edit_posts.