• MichaelH

    (@michaelh)


    Simple, easy, new plugin to redirect you to where you were when you logged in or out.

    Download at https://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:   https://www.viper007bond.com/
    
    add_filter( 'loginout', 'fromwhereyoucame' );
    
    function fromwhereyoucame( $link ) {
    	$currenturl = 'https://' . $_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;
    }
    
    ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • Clicknathan

    (@clicknathan)

    Wicked.

    Any chance you’d know how to make this work for WP 2.0.4?

    Can’t get that one to work. I have download, unzipped and upoaded to the wp-content/plugins and then activated. But it always take we to the dashboard when logged in no matter where i came from? Any ideas?

    Exactly what i was looking for, works perfectly with WordPress 2.6. Thanks!

    does not work for me either, and I am using WP 2.6

    ??

    Thank you so much! It works for me and I am using WP 2.6.1

    Works for me in preliminary testing.
    Thanks!

    I’m using this plugin hand-in-hand with TDO Mini Forms plugin. That lets me put a “Write Post” area with custom fields, in a public part of the website (I have a Page called Submit A Post). It only shows up for Subscribers+ (Members), and asks non-logged-in people to Register or Login. Then it shows the “Write Post” within my site design. Now using fromwhereyoucame plugin the user is directed right back to the Submit A Post page, instead of to the Dashvegas.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin From Where You Came ] – redirect after login or logout’ is closed to new replies.