Simple, easy, new plugin to redirect you to where you were when you logged in or out.
Download at http://files.viper007bond.com/wordpress/fromwhereyoucame.zip
Plugin Name: From Where You Came
Version: 1.0.0
Description: Makes the "Login" and "Logout" links take you back from where you came.
Author: Viper007Bond
Author URI: http://www.viper007bond.com/
add_filter( 'loginout', 'fromwhereyoucame' );
function fromwhereyoucame( $link ) {
$currenturl = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if ( !is_user_logged_in() )
$link = str_replace( '">', '?redirect_to=' . urlencode( $currenturl ) . '">', $link );
else
$link = str_replace( '">', '&redirect_to=' . urlencode( $currenturl ) . '">', $link );
return $link;
}
?>