0

On the multisite main page (http://example.com/) I have a login-form where users can login to their multisite like so:

<?php
$args = array(
    'redirect' => get_active_blog_for_user(),
);

wp_login_form( $args );
?>

After logging in they will be redirected to their dashboard (http:// example.com/userblog/wp-admin/). I don't want them to be redirected to their dashboard. I want them to be redirected to their mainpage instead (http://example.com/userblog/). How can I achieve this?

Kind regards Johan

2 Answers 2

1

I solved this and I only use:

wp_login_form();

Since I don't want users to get access to the wp-admin area at all I use the following code:

// Restrict users from accessing the admin-area
function restrict_admin()
{
    if ( ! current_user_can( 'manage_sites' ) ) {
        wp_redirect( site_url() );
    }
}
add_action( 'admin_init', 'restrict_admin', 1 );

// Disable admin-bar for users
add_action('after_setup_theme', 'remove_admin_bar');

function remove_admin_bar() {
    if (!current_user_can('manage_sites') && !is_admin()) {
        show_admin_bar(false);
    }
}

Kind regards Johan

-1

And what if you have a custom link and you want your users to be redirected there? I used "clean login" plugin and users are redirected to the custom link, but not of their sites. Example i want them to be redirected to www.site.com/user-page/custom-dashboard

But with clean login or others plugins I can only get them to www.site.com/custom-dashboard

So I can not redirect them from the main site to their sites

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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