Community Support Forums — WordPress® ( Users Helping Users ) — 2010-09-28T10:17:12-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=646 2010-09-28T10:17:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=3580#p3580 <![CDATA[Re: Go to previously viewed page after login]]> Statistics: Posted by jhg03 — September 28th, 2010, 10:17 am


]]>
2010-09-26T22:36:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=3532#p3532 <![CDATA[Re: Go to previously viewed page after login]]>
BUT

If you are using the Login Welcome Page to redirect members away from the admin backend then the code above or any code will not work. It will simple redirect them back to the welcome page

You can disable the redirection mode but that defeats the the whole purpose of protecting the backend of your site.

Sam

Statistics: Posted by drbyte — September 26th, 2010, 10:36 pm


]]>
2010-09-26T08:43:57-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=3510#p3510 <![CDATA[Re: Go to previously viewed page after login]]> Statistics: Posted by Guest — September 26th, 2010, 8:43 am


]]>
2010-09-21T22:13:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=3388#p3388 <![CDATA[Re: Go to previously viewed page after login]]>
Any fix? - Thanks!

Statistics: Posted by jhg03 — September 21st, 2010, 10:13 pm


]]>
2010-09-10T01:37:19-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=3161#p3161 <![CDATA[Re: Go to previously viewed page after login]]> Statistics: Posted by Jason Caldwell — September 10th, 2010, 1:37 am


]]>
2010-09-09T10:50:32-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=3101#p3101 <![CDATA[Re: Go to previously viewed page after login]]> Statistics: Posted by jhg03 — September 9th, 2010, 10:50 am


]]>
2010-09-09T10:27:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=3098#p3098 <![CDATA[Re: Go to previously viewed page after login]]> Hi there. Thanks for writing in.
Try this instead. You were really close, just a couple of things needed tweaking.
Code:
<?php
if 
(is_user_logged_in () && current_user_can ("access_s2member_level4"))
    {
        echo '<p class="login-links">';
        echo '<span class="login-greeting">Welcome back, ' . S2MEMBER_CURRENT_USER_FIRST_NAME . '</span><br />';
        echo '<a href="http://www.workplacecoachinstitute.com/cmd.php?cmd=cart">View Cart</a> <span class="login-spacing">|</span> ';
        echo '<a href="http://workplacecoachinstitute.com/?s2member_profile=1">Profile</a> <span class="login-spacing">|</span> ';
        echo '<a href="http://workplacecoachinstitute.com/wp-login.php?action=logout">Logout</a>';
        echo '</p>';
    }
else
    {
        echo '<p>';
        echo '<a href="http://www.workplacecoachinstitute.com/cmd.php?cmd=cart">View Cart</a> <span class="login-spacing">|</span> ';
        echo '<a href="http://workplacecoachinstitute.com/wp-login.php?redirect_to=' . rawurlencode ($_SERVER["REQUEST_URI"]) . '">Login</a>';
        echo '</p>';
    }
?> 

Statistics: Posted by Jason Caldwell — September 9th, 2010, 10:27 am


]]>
2010-09-09T09:59:49-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=3096#p3096 <![CDATA[Re: Go to previously viewed page after login]]>
Here's all my code: (login link in question is at the bottom)

Code:
if (is_user_logged_in() && current_user_can("access_s2member_level4")){
    echo '<p class="login-links"><span class="login-greeting">Welcome back, ';
    echo S2MEMBER_CURRENT_USER_FIRST_NAME;
    echo '</span><br /><a href="
http://www.workplacecoachinstitute.com/cmd.php?cmd=cart">View Cart</a> <span class="login-spacing">|</span> <a href="http://workplacecoachinstitute.com/?s2member_profile=1">Profile</a> <span class="login-spacing">|</span> <a href="http://workplacecoachinstitute.com/wp-login.php?action=logout">Logout</a></p>';
} else {
    return '<p><a href="
http://www.workplacecoachinstitute.com/cmd.php?cmd=cart">View Cart</a> <span class="login-spacing">|</span> <a href="http://workplacecoachinstitute.com//wp-login.php?redirect_to=<?php echo rawurlencode($_SERVER["REQUEST_URI"]); ?>">Login</a></p>';
}


Thank you for your assistance.

Statistics: Posted by jhg03 — September 9th, 2010, 9:59 am


]]>
2010-08-31T23:41:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=2811#p2811 <![CDATA[Re: Go to previously viewed page after login]]> Hi there. Thanks for reporting back.

Here is how I would handle it:
Code:
/wp-login.php?redirect_to=<?php echo rawurlencode($_SERVER["REQUEST_URI"]); ?>

So you will need some PHP for this. That PHP tag:
<?php echo rawurlencode($_SERVER["REQUEST_URI"]); ?>
will automatically insert a link to the current page. So clicking that link from anywhere on your site, will always redirect a visitor back to the page they were viewing before they logged in.

Statistics: Posted by Jason Caldwell — August 31st, 2010, 11:41 pm


]]>
2010-08-31T20:49:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=2806#p2806 <![CDATA[Re: Go to previously viewed page after login]]>
If they were on the About page and logged in, I would want them to return to the About page.
If they were on the Services page and logged in, I would want them to return to the Services page.
(And I have over 50 pages and a login link is on all my posts, so assigning specific values to each of the links isn't an option ;) )

Instead of directing them to one specific page is there perhaps some other code I could include that would say, take them a couple steps back to where they were on my site previously. Just one string that I could use in all my login links?

Sorry for the confusion.

Statistics: Posted by jhg03 — August 31st, 2010, 8:49 pm


]]>
2010-08-31T19:03:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=2802#p2802 <![CDATA[Re: Go to previously viewed page after login]]>
Otherwise, here is how it's done.
Code:
http://example.com/wp-login.php?redirect_to=http://example.com/a-particular-page

So after logging in, they'll be automatically redirected to the redirect_to value.

Statistics: Posted by Jason Caldwell — August 31st, 2010, 7:03 pm


]]>
2010-08-31T11:15:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=646&p=2776#p2776 <![CDATA[Go to previously viewed page after login]]>
Advice appreciated, thank you!

Statistics: Posted by jhg03 — August 31st, 2010, 11:15 am


]]>