Setting login welcome page to referring page/previous page
Posted: March 28th, 2011, 8:08 pm
Hi, I am using s2Member Pro. Referencing this post http://bit.ly/emIaA9 and this post http://bit.ly/gUlA0N, I would like a little more help or information on this particular topic, of redirecting users back to the page they were on before logging in.
This Code was provided on the second post and I was wondering where it would go?
From the Second Post as well:
I don't have a lot of PHP experience but am comfortable enough with Wordpress at this point to understand how the files work together (for the most part). This is something my client would like and I've searched the forum for quite a bit, these are the closest to getting what I want that I've found but don't quite understand how to do it.
Thanks in advance for your help!
This Code was provided on the second post and I was wondering where it would go?
- Code: Select all
<?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>';
}
?>
From the Second Post as well:
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.
I don't have a lot of PHP experience but am comfortable enough with Wordpress at this point to understand how the files work together (for the most part). This is something my client would like and I've searched the forum for quite a bit, these are the closest to getting what I want that I've found but don't quite understand how to do it.
Thanks in advance for your help!