Permissions page error on a multisite

Community Forums Forums General Discussion Permissions page error on a multisite

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Andrea Rennick 6 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #101002

    andym119
    Member
    Post count: 72

    I really need help with a wordpress question and something that only happens on a subdomain multisite:

    I have a sub domain multisite, and I have login links on my homepage, and so if a user has a site at usersite.mysite.com and logs in at mysite.com/login a permissions error page comes up as it thinks they are trying to login to mysite.com. On the permissions error page it also has the users blog links at the bottom of that error page and so they can click them links to go to their blog. This doesn’t happen on a sub directory install of multisite as users can log straight in to their dashboard with no permissions error, and I have been told thats just the way it works with subdomains, users have to login at their blog url each time: usersite.mysite.com/login.

    So just to clarify a user that has a blog at usersite.mysite.com can login in two ways –
    1 – at usersite.mysite.com/login
    or
    2 – at mysite.com/login but they go to a perimissions error page which has their blog links on it to their site/dasboard.

    I’m looking for a way for a user to go straight to their blog at usersite.mysite.com without going to that permissions error page if they login at mysite.com/login.

    The best solution I found if anyone else is interested is to put:

    add_action('wp_login','go_home');
    function go_home(){
       wp_redirect( home_url() );
      exit();
    }

    This will redirect to the main (network admin) homepage – mysite.com, the user can then hover over the my sites link in the top admin bar to go to their sites.

    Also, I noticed when your on someone elses blog, clicking on the my-sites link directly instead of using the my-sites sub menu to go to your blog, you also go to that permissions error page. After looking in admin-bar.php in wp-includes it has:

    foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
    		switch_to_blog( $blog->userblog_id );

    This code is inside the my-sites parent rather than outside so that is why that goes to that permissions error page so I worked out a way to rewrite the code in my functions.php to put that code on the outside, I’m no good with php but I tried a few things and somehow I got it to work perfectly.

    I just thought, is there a way to do the same thing by adding the switch_to_blog line and add_action(‘wp_login’,’go_to_blog’); together somehow so it switches to the correct blog when logging in?

    Any help with this will be much appreciated

    • This topic was modified 6 months, 1 week ago by  andym119.
    • This topic was modified 6 months, 1 week ago by  andym119.
    • This topic was modified 6 months, 1 week ago by  andym119.
    • This topic was modified 6 months, 1 week ago by  andym119.
    #101013

    Andrea Rennick
    Keymaster
    Post count: 1302

    Please post in the multisite forum on WordPress.org so more people who use multisite can see it.

    This isn’t really a Genesis issue.


    **forum signature**
    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    Twitterholic

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.