Community Support Forums — WordPress® ( Users Helping Users ) — 2011-11-06T11:29:47-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=15522 2011-11-06T11:29:47-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=52378#p52378 <![CDATA[Re: Login Redirect not working]]>
Changelog excerpt related to this issue.
http://wordpress.org/extend/plugins/s2member/changelog/
(s2Member Pro) Improvement. The s2Member Pro Login Widget now has improved handling of its %%previous%% Replacement Code for login redirections.

Statistics: Posted by Jason Caldwell — November 6th, 2011, 11:29 am


]]>
2011-11-06T02:25:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=52367#p52367 <![CDATA[Re: Login Redirect not working]]>
Code below can be pasted into the page that members get redirected to and after logging in they will be directed to the page they were trying to visit that is membership protected.

Code:
<?php
$options 
= array(
"title" => ""
"signup_url" => ""
"login_redirect" =>  "%%previous%%",
"profile_title" => "",
"display_gravatar" => "0"
"link_gravatar" => "0"
"display_name" => "0"
"logged_in_code" => ""
"logout_redirect" => ""
"my_account_url" => "0"
"my_profile_url" => "0" 
);
$args = array (
"before_widget" => "<div class=\"member_login_widget\">",
"after_widget" => "</div>",
"before_title" => "<h5>",
"after_title" => "</h5>"
);
echo 
s2member_pro_login_widget($options$args);
?>

Statistics: Posted by denvert — November 6th, 2011, 2:25 am


]]>
2011-11-05T16:28:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=51093#p51093 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by Jason Caldwell — November 5th, 2011, 4:28 pm


]]>
2011-11-03T11:02:14-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=50907#p50907 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by Jason Caldwell — November 3rd, 2011, 11:02 am


]]>
2011-11-01T21:06:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=50743#p50743 <![CDATA[Re: Login Redirect not working]]>
I tried these two things you said to try before,

"login_redirect" => $_GET["previous"],

"login_redirect" => "$_SERVER["HTTP_REFERER"],

and am still just getting the page that the login form is set up on. It seems like the page that is getting re-directed to the login page never gets recognized to go back to.

Statistics: Posted by denvert — November 1st, 2011, 9:06 pm


]]>
2011-11-01T20:42:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=50742#p50742 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by denvert — November 1st, 2011, 8:42 pm


]]>
2011-10-31T20:25:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=50637#p50637 <![CDATA[Re: Login Redirect not working]]> http://downloads.wordpress.org/plugin/s2member.zip

Then patch your existing installation of s2Member Pro v111029 with the attached file:
Override your existing copy of /s2member-pro/includes/classes/login-widget.inc.phplogin-widget.inc.php.zip

Statistics: Posted by Jason Caldwell — October 31st, 2011, 8:25 pm


]]>
2011-10-31T11:31:58-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=50534#p50534 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by denvert — October 31st, 2011, 11:31 am


]]>
2011-10-31T11:26:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=50533#p50533 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by Jason Caldwell — October 31st, 2011, 11:26 am


]]>
2011-10-30T16:15:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=50472#p50472 <![CDATA[Re: Login Redirect not working]]>
Were you able to address this issue in the new updates?

Thanks

Statistics: Posted by denvert — October 30th, 2011, 4:15 pm


]]>
2011-10-21T13:53:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48517#p48517 <![CDATA[Re: Login Redirect not working]]>
Sorry for all the confusion, we can use a temporary fix, hopefully you'll be able to integrate with next update. Thanks again for all your help.

Best, Chris

Statistics: Posted by denvert — October 21st, 2011, 1:53 pm


]]>
2011-10-21T13:37:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48515#p48515 <![CDATA[Re: Login Redirect not working]]>
denvert wrote:
I'm depending on the re-direction that s2member does.

Thank you. OK, I see what you're dealing with now. I'm adding this to our TODO list for the next release. I'll see if we can get the %%previous%% Replacement Code working on this special page (in the way you're describing) so that others do not have this same confusion.

The next release should be available early next week. Until then, if you need a solution to this problem immediately, you may want to seek assistance from a PHP developer. Point them to this thread, and with the information I've posted above, they should be able to get this working for you.

s2Member® / Hot Tip: ( s2Installs.com! )

Recommended by s2Member® Lead Developer (Jason Caldwell). Their rate for a standard installation is $125. They're highly trained. Just request their service!

Need Help? Post A New Job!

It's free. Your Job will appear here, and @ jobs.wordpress.net. It will be displayed for a period of 21 days; or until you take it off, whichever comes first. Good luck!

Statistics: Posted by Jason Caldwell — October 21st, 2011, 1:37 pm


]]>
2011-10-20T22:29:05-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48458#p48458 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by denvert — October 20th, 2011, 10:29 pm


]]>
2011-10-20T19:01:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48448#p48448 <![CDATA[Re: Login Redirect not working]]> Thanks. I understand.
Before I add another reply, can you please clarify the following for me?

Are you handling the redirection yourself through a script that you've written?
Or, are you depending on the redirection that s2Member does ( i.e. to your Membership Options Page ) when a visitor attempts to access protected content without being logged-in?

Statistics: Posted by Jason Caldwell — October 20th, 2011, 7:01 pm


]]>
2011-10-20T17:28:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48434#p48434 <![CDATA[Re: Login Redirect not working]]>
Does it help to take a step back and re-evaluate what i'm trying to do?

I try to enter a page that is protected by S2, it re-directs to a page with a link to the register page or the attached login form below. When the person logs in they are logged in to the page that they were initially trying to access before being "re-directed" or sent (whatever we should be call it) by s2.

The client's experience was they sent out an e-mail to protected page, e-mail recipient is then re-directed to login page, they then land on a seperate page then the one they were initially trying to access but another page which they then had to go back to e-mail to copy the url and re-enter it.

Statistics: Posted by denvert — October 20th, 2011, 5:28 pm


]]>
2011-10-20T17:18:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48430#p48430 <![CDATA[Re: Login Redirect not working]]> $_SERVER["HTTP_REFERER"] on your custom Login Page.
Is this data being populated by your installation of PHP?
Code:
<?php echo $_SERVER["HTTP_REFERER"]; ?>

Depending on how you're doing the redirection, it may not get populated. If that's the case, you may need to pass this information through your custom redirection instead. In other words, you might need to pass the URI of the page the Visitor was on "before" you redirect them.

Example:
When you redirect a visitor, add this to your redirection URL:
Code:
http://example.com/my-custom-login-page/?previous=<?php echo urlencode($_SERVER["REQUEST_URI"]); ?>

Then, you might do something like this in your Pro Login Widget implementation:
Code:
"login_redirect" => $_GET["previous"], 

Statistics: Posted by Jason Caldwell — October 20th, 2011, 5:18 pm


]]>
2011-10-20T17:11:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48427#p48427 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by denvert — October 20th, 2011, 5:11 pm


]]>
2011-10-20T17:06:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48426#p48426 <![CDATA[Re: Login Redirect not working]]> Thank you. Please remove the double quotes here:
Code:
"login_redirect" => "$_SERVER["HTTP_REFERER"]",

Code:
"login_redirect" => $_SERVER["HTTP_REFERER"], 

Statistics: Posted by Jason Caldwell — October 20th, 2011, 5:06 pm


]]>
2011-10-20T17:04:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48424#p48424 <![CDATA[Re: Login Redirect not working]]>
Code:
<?php
$options = array(
"title" => "",
"signup_url" => "http://xxx.xxxxxx.org/register/",
"login_redirect" => "$_SERVER["HTTP_REFERER"]",
"profile_title" => "",
"display_gravatar" => "0",
"link_gravatar" => "0",
"display_name" => "0",
"logged_in_code" => "",
"logout_redirect" => "http://xxx.xxxxxx.org",
"my_account_url" => "0",
"my_profile_url" => "0"
);
$args = array (
"before_widget" => "<div class=\"member_login_widget\">",
"after_widget" => "</div>",
"before_title" => "<h5>",
"after_title" => "</h5>"
);
echo s2member_pro_login_widget($options, $args);
?>

Statistics: Posted by denvert — October 20th, 2011, 5:04 pm


]]>
2011-10-20T17:01:29-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48423#p48423 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by denvert — October 20th, 2011, 5:01 pm


]]>
2011-10-20T16:55:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48421#p48421 <![CDATA[Re: Login Redirect not working]]> Thanks for the reply.

A blank white page would indicate a PHP parse error.
Please be sure that you have a comma at the end of that line.
Code:
"login_redirect" => $_SERVER["HTTP_REFERER"], 


I'm not trying to return them to the page they logged in from but the page that directed them to the page they logged in from. Does that make sense?
Right, but since you're redirecting Visitors to your own custom "Login Page" constructed with the s2Member Pro Login Widget, you need to record the page they came from "before" they were redirected to your custom "Login Page", which is not the same thing as %%previous%%. You can read more about $_SERVER["HTTP_REFERER"] here: http://php.net/manual/en/reserved.variables.server.php

Statistics: Posted by Jason Caldwell — October 20th, 2011, 4:55 pm


]]>
2011-10-20T16:49:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48420#p48420 <![CDATA[Re: Login Redirect not working]]>
if i replace, "login_redirect" => "%%previous%%",
with

"login_redirect" => $_SERVER["HTTP_REFERER"]

just shows a blank white page.


also this doesn't make sense

"This is the intended behavior, in this one special scenario, because returning a logged-in User to a set of Membership Options is not intuitive."

I'm not trying to return them to the page they logged in from but the page that directed them to the page they logged in from. Does that make sense?

Statistics: Posted by denvert — October 20th, 2011, 4:49 pm


]]>
2011-10-20T16:32:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48418#p48418 <![CDATA[Re: Login Redirect not working]]>
Just to clarify...
All roads to log into your site, lead to /wp-login.php ( it's your universal "Login Page" ). The s2Member Pro Login Widget makes it possible to place a Pro Login Widget/Form on any page of your site, but this Pro Login Widget/Form still posts data to /wp-login.php.

The %%previous%% Replacement Code records the section of your site where the Pro Login Widget is used. This data is sent to /wp-login.php, and upon the User's login data being processed successfully, the User/Member is redirected back to the page they were viewing previously.

Some additional confusion might be occurring in your case as well, since you're placing the Pro Login Widget on your Membership Options Page. s2Member treats this page just bit differently with respect to the %%previous%% Replacement Code:
Jason Caldwell wrote:
There is one exception that s2Member treats differently though, and that is your Membership Options Page. If a Customer attempts to log into your site from your Membership Options Page, the %%previous%% Replacement Code is ignored, and instead the Customer will be returned to your Login Welcome Page by default. This is the intended behavior, in this one special scenario, because returning a logged-in User to a set of Membership Options is not intuitive.


In your case, you can accomplish what you need, but I recommend doing it this way.
Code:
"login_redirect" => $_SERVER["HTTP_REFERER"] 
* ( i.e. the page that referred them to your own custom login page )

Statistics: Posted by Jason Caldwell — October 20th, 2011, 4:32 pm


]]>
2011-10-20T16:17:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48414#p48414 <![CDATA[Re: Login Redirect not working]]> Statistics: Posted by denvert — October 20th, 2011, 4:17 pm


]]>
2011-10-20T16:05:49-05:00 http://www.primothemes.com/forums/viewtopic.php?t=15522&p=48411#p48411 <![CDATA[Re: Login Redirect not working]]> Thanks for the follow-up.

You said...

user is sent to re-directed to login page that has code generated from the document you give link to, specifically,
* Can you elaborate just a bit further for me please?
Is this page a redirection? Sorry, just want to be sure I understand completely.

The %%previous%% Replacement Code works like this internally.
Code:
$redirect_to = preg_replace ("/%%previous%%/i", $_SERVER["REQUEST_URI"], ($redirect_to = $options["login_redirect"])); 

Statistics: Posted by Jason Caldwell — October 20th, 2011, 4:05 pm


]]>