In the interest of possibly helping other individuals with similar ideas, here is an exact, (if not overkill) description of how ONE plugin has worked for me every time I have used it, as well as an exact description of what it does. I am sure that there are numerous other solutions that do the same, if not more, depending on your needs and expectations, but I like to try and keep it simple.
- Click this link and save the file to your desktop.
Login-Stayput Plugin
- Note the file extension. It is .gz, not .zip, or .php. This is a file that is compressed or "zipped" with the gzip compression algorithm. If you are using a Windows computer, you will need a utility to extract the file from the .gz archive. I recommend you download the latest stable version of 7zip, or your own favorite archive utility for Windows, and install it. If you are not using a Windows computer, you will already know what to do with the archive. Once that is done, right click the file and extract the contents to your desktop. You now have a folder labeled login-stayput-php on your desktop. Inside that folder is one file. It is named login-stayput and will now have a .php extension. (You may not be able to see the extension on a Windows machine by default).
- Upload the file "login-stayput.php" to your plugins directory. No folder, no .gz archive, just the file named "login-stayput.php".
- Activate the plugin and log out.
- Go to the home/front page of your blog.
- Click on the login link
- At the login screen, enter your information and submit, and you will be taken BACK to the page you came from. NOT TO THE DASHBOARD, the back-end, the profile manager, the VIEW SITE link, or whatever you choose to call the administrative interface.
This is the author credit, and his description of what this plugin does;
Plugin Name: Login Stayput
Description: Sets redirect_to on wp_loginout function to keep users on the same page they were on when they clicked login. Inspired by Weasel's Login Redirect / Text Change
Author: Justin S. Peavey
Version: 1.0
Author URI: http://www.trashcan.org
Here is the contents of the plugin file for your inspection:
<?php
function jsp_loginredirect($link) {
// Add redirect_to argument
$from = $_SERVER['REQUEST_URI'];
if (substr_count($link,'?') > 0) {
$link = str_replace('">','&redirect_to='.$from.'">',$link);
} else {
$link = str_replace('">','?redirect_to='.$from.'">',$link);
}
return $link;
}
add_filter('loginout','jsp_loginredirect');
?>
The author invites anyone with modifications, suggestions, or improvements to freely do so, and I quote;
"This is about as simple as a plugin can get, this plugin sets the redirect_to on your login link to be the same page that the login link is on. This keeps users on the same page and stops them from going to the wp-admin interface. This has only been tested with WordPress 2.0.5 and I’ll likely update it for future versions as I upgrade. I am not offering support for feature requests, but if something is broken, post a comment here and I’ll take a look when I get a chance. No promises. If you extend its functionality or clean it up, please feel free but also please post your updates here."
Here you go; http://www.trashcan.org/2006/12/15/wordpress-login-stayput-plugin/
It does exactly as it says. When a user logs in, or out, it returns that user to the page they were viewing when they selected the "login" or "logout" link. NOT TO THE DASHBOARD. It also performs the exact function that you (steverf), have expressed your desire for so many times over.
I have used this plugin myself through several versions of WordPress with no problem at all. As a control measure, I installed it on two WordPress blogs in the last 24 hours. Both versions 2.6.1. The plugin performed as expected, with no additional effort other than activating it, on both sites.
Just to recap... and I'll use the short version this time, I promise...
-Download it.
-Extract it.
-Upload the file to your plugin folder and activate it.
Now that's simple. If you are searching for a non-plugin solution, I suppose you would have to be comfortable with understanding the code you need to edit, and the implications and inconvenience (ever forgotten to save a modified file before doing an upgrade?) of doing so.
I leave you to reach your own conclusions.