Redirect Pro Sites user to their own site's dashboard?

What is the best way to redirect a Pro Sites user (subdomains) to their own site's dashboard? Thought I saw something on this but can't find it now. Thanks.

  • Vaughan

    Hi @Webmaster,

    You can use a plugin such as http://wordpress.org/plugins/peters-login-redirect/other_notes/

    Please be aware that users aren't pro sites users, it's the actual site that is the pro site. All you can do really is redirect to that users primary blog, it's possible for users to have multiple sites/blogs, which is why most ask for redirection to the primary site.

    Hope this helps.

  • Webmaster

    Thank for your answer Vaughn.

    I have users restricted to one site each, so that's not an issue.

    The thing is, either Pro Sites or the underlying MU install is currently redirecting them to the dashboard for the main site where they signed up, where they were automatically assigned a Contributor status based on my configuration.

    I was only trying to redirect them to their main/only website dashboard.

    Is a plugin really the best way to change that one URL?

    Thanks.

  • Webmaster

    I thought I had finally found the solution to this problem here, but neither of the attached plugins (this one or this one) will download. They just bring up blank pages.

    So this appears to be a repeated request that goes back at least FOUR YEARS! There have been snippets and plugin code thrown out there, but none of it seems to work for one good reason or another.

    There also seems like a legitimate basis for the need for this plugin - people get confused easily. Redirecting people to their own dashboard on their main website is only going to help make the product (plugin) more useful - to those trying to implement it (WPMUDEV members) and the people they are trying to support (member customers).

    I tried Peter's Redirect and used his variable for username, but it didn't work. Actually, that is what is needed is the variable for the username - at least in my case. I only allow one website and the sub-domain name is required to be identical as the website's sub-domain name by Pro Sites. So a redirect to http://%username%.domain.com/wp-admin would work in every instance - at least for me. It may be an option I set, but as I said, in my Pro Sites signup form there is no option to have a different username than the primary website's sub-domain.

  • Alexander

    Hi @Webmaster,

    I saw you post on another thread, and wanted to chime in here.

    First, just to clarify, this has nothing to do with Pro Sites. It's just how WordPress Multisite works.

    In fact, adding this functionality can cause other issues. For example, what if a user wanted to login to view another site? Or what if they have multiple sites?

    What we can do, is get the current user's primary blog, and send them to that dashboard. Keep in mind that this affects everyone, so if your sites interact with each other at all, this could be confusing.

    function login_redirect_to_primary_blog() {
        return get_admin_url(get_active_blog_for_user(get_current_user_id())->blog_id);
    }
    add_filter('login_redirect', 'login_redirect_to_primary_blog' );

    Best regards,

  • Webmaster

    @Alexander - thanks for the code, but I think what I am trying to do is a little less problematic than what you describe.

    First, besides being a Contributor on my main network site, all of my network users may have only one site of their own. So they would have to delete that site in order to create another.

    Second, and more importantly, I'm not trying to restrict them to a specific login landing page; they should be able to set that to the main network site if they want.

    What I am trying to do is (at the time the user is creating their one website) set primary_blog to the site that was just created.

    As I said, for all I care they can go to My Sites and use the dropbox to set their Primary Site back to the main network site if they want to; I just don't think many will want to do that.

    I do believe that having the primary site set to the same site a user just created will prevent confused users from just creating sites and never doing anything with them because they don't see where to change anything.

    I tried adding this in the wp-signup.php file...

    After the line that says this:

    do_action( 'after_signup_form' );

    I added this:

    add_action('wpmu_new_blog','update_primary_blog',10, 1);
    function update_primary_blog($blog_id) {
    	update_user_meta( get_current_user_id(), 'primary_blog', $blog_id);
    }

    For what I'm sure are obvious reasons to others, it did not work.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.