shakee93
shakee93

Reputation: 5406

Redirect Specific User

I need to redirect a specific user to a specific page. It's a hidden page, I want only him to access that when he is logged in. I have managed to add the WordPress login on a page. I want the user to login via that.

I've tried Peter's login redirect as it is the only plugin that gives rules to a specific user.

Upvotes: 1

Views: 141

Answers (1)

shakee93
shakee93

Reputation: 5406

Thanks for everyone who replied.

got it working with below function. http://codex.wordpress.org/Function_Reference/wp_get_current_user

got information from above.. below is the code. added this on themes function.php.

function redirect_specified_user()
    {
    global $current_user;
    get_currentuserinfo();

    // User 1
    $specific_user1 = "test12";
    $specific_user1_Url = "http://www.yoursite.com/anywhere/";

    // Specify Users Functions
    if ($current_user->user_login == $specific_user1)
    {
        wp_redirect( $specific_user1_Url ); exit;
    }
    }
add_action('admin_init', 'redirect_specified_user');

Upvotes: 1

Related Questions