• Resolved bilzjkhan

    (@bilzjkhan)


    Hi,

    I love your plugin and I am interested in buying the full paid package. Currently i am building a multisite network project and testing it with ultimate members.

    I have checked login/redirect usage in ultimate members it is pretty cool, but i am having issues when i set up seperate login redirect page for each user role on subsite.

    >> What i want to achieve?
    Use single login form on main site and redirect users to subsite home page?

    Problem:
    When user login from main site it is not redirected to users subsequent subsite home page, and instead it shows user profile on the main site. It will work even if it can show profile on subsite but for that user need to login from same subsite.

    >> What i have done so far?
    I have tried a below snippet and deactivted the ultimate member plugin and it works fine and redirects the users to their respective subsite home page. I have even tested it with buddypress and it works fine.
    function ds_login_redirect( $redirect_to, $request_redirect_to, $user )
    {
    if ($user->ID != 0) {
    $user_info = get_userdata($user->ID);
    if ($user_info->primary_blog) {
    $primary_url = get_blogaddress_by_id($user_info->primary_blog) . ‘/’ ;
    if ($primary_url) {
    wp_redirect($primary_url);
    die();
    }
    }
    }
    return $redirect_to;
    }
    add_filter(‘login_redirect’,’ds_login_redirect’, 100, 3);

    >> What help is required?
    Need help to disable redirect function for ultimate member however the keep the plugin active for remaining functions.

    Or I any other solution you can recommend please. I have also tried user role base redirect but it still keeps the user on main site when login from main site and does not take it the url defined for the role.

    I will be very happy if you can assist me regarding this issue.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @bilzjkhan, did you find any solutions to this?

    I am having trouble with the same issue. I’m trying to redirect to the homepage of a sub site in a network after Login. But it keeps forcing the User to their profile page instead. None of the redirect settings work.

    The ‘Hide Admin bar’ setting doesn’t work on the sub site either, but does work on the primary site. It’s weird!

    And it’s not just after login either, but even if you visit another page and try come back to the homepage, it always redirects to /user/username.

    The plugin is hijacking the WP home_url for the sub site.

    • This reply was modified 6 years, 10 months ago by ViscoDesign.

    I have the same problem. When a user registers to the main site and then wants to log on to any subdomain, it is immediately redirected to the user page. Redirecting occurs only on the subdomains where he did not register. and the admin bar can not be hidden.

    is there any way to fix it?

    Many thanks

    Thread Starter bilzjkhan

    (@bilzjkhan)

    @homolis @viscodesign

    Unfortunately no support yet from ultimate member on this issue . Therefore i moved to Buddypress for user registrations and resolved it by using the following method on my website:

    1. Install buddypress and setup its default configurations.
    2. Download and install Code Snippets plugin By Shea Bunge
    3. In the Network Dashboard open snippets and Add your first snippet with the following code for login redirect subsite.
    function ds_login_redirect( $redirect_to, $request_redirect_to, $user )
    {
    if ($user->ID != 0) {
    $user_info = get_userdata($user->ID);
    if ($user_info->primary_blog) {
    $primary_url = get_blogaddress_by_id($user_info->primary_blog) . ‘/’ ;
    if ($primary_url) {
    wp_redirect($primary_url);
    die();
    }
    }
    }
    return $redirect_to;
    }
    add_filter(‘login_redirect’,’ds_login_redirect’, 100, 3);

    4. Now add another snippet for logout redirect replace the url with your domain or website desired page.

    add_action(‘wp_logout’,’auto_redirect_external_after_logout’);
    function auto_redirect_external_after_logout(){
    wp_redirect( ‘https://yourdomain.com’ );
    exit();
    }

    Note: you will need to add these snippets in the network admin dashboard snippets options and share the snippets for all the network.

    By above codes what i have achieved is that when user login on the main site through widget or wp-login its automatically redirected to subsequent subsite. And when log’s out from the subsite it comes back to the main site home page.

    Hope this help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multisite Usage and Redirection to Subsite’ is closed to new replies.