Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.
Close

#30 New users automatically added as contributor to main blog

open
nobody
None
5
2011-09-06
2011-09-06
spiffywiffy
No

Hi:

I'm unsure if this is related to the WPMU LDAP plugin I use (3.1.1), but it seems like a possibility. I just upgraded my WPMU install to 3.2.1 Multisite. I have the LDAP plugin set to auto-create accounts and blogs upon successful LDAP login - which it does without problem. However, in my case, new users are also being added as "Contributor" to the main blog (in my case blog id 1). This is unexpected as it was not the case before when I was using WPMU 2.9.

Can you let me know if this is related to this plugin or is simply expected behaviour in WP 3.2. Any advice on how to prevent the user being added to the main blog would certainly be appreciated.

Thanks!

Discussion

  • spiffywiffy

    spiffywiffy - 2011-09-06

    i found this in wpmu_ldap.functions.php:

    /**
    * Checks to make sure the user is added to the dashboard blog (if set) or else blog #1
    */
    function wpmuUpdateBlogAccess($userid) {
    // reset primary blog to #1 (or dashboard) and add subscriber role
    if ($dashboard = get_site_option( 'dashboard_blog' )) {
    add_user_to_blog( $dashboard, $userid, get_site_option( 'default_user_role', 'subscriber' ) );
    update_usermeta($userid, "primary_blog", $dashboard);
    } else {
    add_user_to_blog( '1', $userid, get_site_option( 'default_user_role', 'subscriber' ) );
    update_usermeta($userid, "primary_blog", 1);
    }
    }

    However, I'm afraid my PHP skills are not good enough to know if this code is causing this behavior. It seems possible.

    Thanks.

     
  • spiffywiffy

    spiffywiffy - 2011-09-06

    Sorry to keep adding comments, but..

    I commented out the code below and logged in with my test user for the first time. It went to a white screen - ie. didn't redirect to their dashboard. So, I just edited the url to go to wp-admin for that users blog, and it successfully went to the Dashboard, and most importantly, they were not added to main site as a Contributor (this is a side mystery to me - why they were ever added as Contributor).

    So, I presume I just need to make a modification to the code I posted instead of commenting the entire thing out, in order to prevent the white screen. Just need help for that.

    Thanks!

     
  • Cristian Rigamonti

    I've been bitten by this too. This is especially annoying since the new user sees the main blog's empty dashboard as the first entry in "My sites" and will get confused.

    To disable it until a proper fix is found, instead of commenting the function definition, I've commented the function call at user creation time, i.e. /lib/wpmu_ldap.functions.php line 88:
    //wpmuUpdateBlogAccess($user_id);

     
  • spiffywiffy

    spiffywiffy - 2011-09-28

    Thanks for that crig. Not sure what's going on with development for wpmu-ldap. Fantastic plug-in - for us anyway. Hopefully a developer can chime in soon.

     

Log in to post a comment.