1

I have created a web site for a company with lots of sub sites using multisites in word press. These sub sites are password protected and those are for different clients.

Lets say for an example :- my main site is www.example.com

  and I have two sub sites called :- www.example.com/client_one  
                                     www.example.com/client_two

I want to have the client login window in my main site (www.example.com), with username and password.

What i want to do is, If a Member from client one place enter his or her given username and password correctly then i want to redirect them in to www.example.com/client_one/landing page.

same way for other member from client two to ---> www.example.com/client_two/landing page

is it possible to do in word press ? Do I need any plugins to do that?

0

There is a filter called login_redirect which you can use. The third parameter passed to this filter is the user object, so you have all kinds of possibilities to redirect. Like this:

add_filter ('login_redirect', 'wpse63660_redirect', 10, 3);

function wpse63660_redirect ($redirect_to, $request, $user) {
    //is there a user to check?
    if ( isset( $user->roles ) && is_array( $user->roles ) ) {
        //check for admins
        if ( in_array( 'administrator', $user->roles ) ) {
            // redirect them to the default place (dashboard
            return $redirect_to;
        } else {
            // set redirect page based on user name or whatever you want
            if ($user->name == 'user1') $redirect_to = www.example.com/client_one
            elseif ... and so on ...
            return $redirect_to;
        }
    } else {
        return $redirect_to;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.