Forum Replies Created

Viewing 1 replies (of 1 total)
  • This is exactly how we login a user automatically, at any role, maybe it will help.

    function autoLogin( $user ) {
            if (!$user = get_user_by('login', $user)) {
                    echo __LINE__;
                    return;
            }
            wp_set_current_user( $user->data->ID, $user->data->user_login);
            wp_set_auth_cookie( $user->data->ID );
            do_action( 'wp_login', $user->data->user_login );
            header( 'Location: '.site_url());
    }
    • This reply was modified 8 years, 8 months ago by bcworkz. Reason: code fixed
Viewing 1 replies (of 1 total)