The MU forums have moved to WordPress.org

wp-login redirect pains (7 posts)

  1. bigdoug
    Member
    Posted 16 years ago #

    Hi there,
    I want to make it so that when a user logs in it automatically redirects them to their primary blog. In my system the primary blog is the same is the username (some hacking, obviously)

    I've been beating my head on this. Really wish it was an easy built-in as it is in other cms/blog packages.

    Below is where I gave up...
    Any help would be appreciated. Thanks in advance.

    if ( !isset( $_REQUEST['redirect_to'] ) || is_user_logged_in() ){
    		$user_login = $_POST['log'];
    		$user_login = sanitize_user( $user_login );
    		$redirect_to = 'http://'.$user_login.'.mysite.com/';
    		}
    	else{
    		$user_login = $_POST['log'];
    		$user_login = sanitize_user( $user_login );
    		$redirect_to = 'http://'.$user_login.'.mysite.com/';
    		//$redirect_to = $_REQUEST['redirect_to'];
    }
  2. pitttih
    Member
    Posted 16 years ago #

    i need this too!
    anyone ?

  3. pitttih
    Member
    Posted 16 years ago #

    anyone?!

  4. carnold
    Member
    Posted 16 years ago #

    if ( !isset( $_REQUEST['redirect_to'] ) || is_user_logged_in() )
    $redirect_to = 'http://'.$user_login.'mysite.com';
    else
    $redirect_to = $_REQUEST['redirect_to'];

    if ( $_POST ) {
    $user_login = $_POST['log'];
    $user_login = sanitize_user( $user_login );
    $user_pass = $_POST['pwd'];
    $rememberme = $_POST['rememberme'];
    } else {
    $cookie_login = wp_get_cookie_login();
    if ( ! empty($cookie_login) ) {
    $using_cookie = true;
    $user_login = $cookie_login['login'];
    $user_pass = $cookie_login['password'];
    }
    }

    Redirects to main blog site and not user blog. Can anyone shed some light?

  5. pitttih
    Member
    Posted 16 years ago #

    so .. you mean millions people of wp community dosen't know a solution for this simple code ?!
    Really?!

  6. carnold
    Member
    Posted 16 years ago #

    Really want this. Can anyone help?

  7. pitttih
    Member
    Posted 16 years ago #

    Me too , Help us please

About this Topic