Multi-Site Manager > Site Admins?

Update: The fix for this is to use our new multi-domain plugin.

Hey guys, I'm setting up a new WPMU with Multi-Site Manager running some other domains on top of it.

The other domains will have their own site admins.

I want to know how I can make it so site admins can only edit other site admins if they are a site admin of the main blog.

Alternatively, I would like to give admins of a blog the ability to administer sub blogs.

What would be the best way to do this, is there a way to do it in the form of a plugin?

Thanks in advance.
Dustin

  • Andrew

    HIya,

    I want to know how I can make it so site admins can only edit other site admins if they are a site admin of the main blog.

    You lost me a bit there with the 'a site admin of the main blog' bit. Site admins are note specifically attached to a certain blog. They're administrators on all blogs.

    Alternatively, I would like to give admins of a blog the ability to administer sub blogs.

    Lost me with this one as well. What do you mean by sub blog?

    Thanks,
    Andrew

  • maxaud

    The multi-site manager allows you to define different 'site admins' for each 'site.'

    So when I have a site admin on blog 2, and he's not a site admin on blog 1, he doesn't have the 'Site Admin' menu item available when he's on blog 1 but he does on blog 2.

    As for the second part, I meant, give the ability to blog admins (not site admins) of 'sites' to administer the sub blogs associated with the 'site'.

    Thanks Andrew for your timely reply.
    I hope I was a bit more clear this time.

    Dustin

  • Andrew

    So when I have a site admin on blog 2, and he's not a site admin on blog 1, he doesn't have the 'Site Admin' menu item available when he's on blog 1 but he does on blog 2.

    That still doesn't make sense I'm afraid. Blogs don't have site admins, sites do.

    Did you meant Site 1 and Site 2?

    As for the second part, I meant, give the ability to blog admins (not site admins) of 'sites' to administer the sub blogs associated with the 'site'.

    That should be doable via a plugin. It may require a mild hack though to the is_site_admin function though.

    Thanks,
    Andrew

  • maxaud

    Andrew,

    Thanks for your reply.
    I'm sorry your not understanding my terminology correctly, I thought I was making it clear enough, though I guess people read things differently.

    I suppose the correct terms would be site 1 and site 2.

    How would I make it so a 'site admin' from 'site 2' cannot edit other 'site admins'. While 'site admins' from the main WordPress MU installation 'site' (usually running blog #1) can edit all users, even other 'site admins'?

    How I'm setting this up, I don't want site admins of my sites to be able to change the information of other site admins, unless you're a site admin the main initial site.

    Basically three admin user levels:
    Main Site Admin: Can edit anything and everything. Only available to site admins of the main blog.
    Regular Site Admin: Can only edit information pertaining to the site they are a site admin for. Cannot edit other site admins information (email, profile, etc.).
    Administrator: regular blog administrator

    Thanks for your time and replies.
    Dustin

  • Andrew

    Hiya,

    How would I make it so a 'site admin' from 'site 2' cannot edit other 'site admins'.

    Site admins by nature can edit anything on the site. You would need a custom plugin to keep them from editing other site admins.

    While 'site admins' from the main WordPress MU installation 'site' (usually running blog #1) can edit all users, even other 'site admins'?

    That would be a bit tricky. You would basically need a 'System Admin' feature like the one we built for Blogs.mu. Site admins can only edit items on their own site. So you need something above the site admin in order to be able to edit everything on all sites.

    Note that you could just create a plugin to add the site admins on the main site to all sites. The plugins required to fix your first issue (above) would keep anyone from removing them.

    Thanks,
    Andrew

  • Andrew

    Hiya,

    Do you plan on releasing or sharing code used on Blogs.mu to accomplish this?

    That's up in the air at the moment. It would take a fair amount of work to turn it into a distributable plugin. So it's definitely not something we'll be releasing in the immediate future. Maybe early next year.

    which is why I'm here asking how I can accomplish this.

    I'm afraid it will definitely take some custom coding to accomplish what you're wanting.

    Note that the feature allowing site admins on the main site/blog to have access to all other sites somewhat goes against the idea of multiple sites. So that's a rather custom requirement I'm afraid.

    Thanks,
    Andrew

  • maxaud

    I suppose I'll have to look at coding it and/or waiting for a possible release.

    Basically, what I don't want is a 'Site Admin' from one 'Site' to be able to edit the profile of other site admins, unless they're site admin on the main 'site'.

    The Multi-site Manager automatically adds the 'Site Admin' list from the main 'site' to the newly created 'sites'.

    I suppose I could edit some core files with some conditional tags to see if a user is a 'site admin' and if they belong to the main 'site'.

    Thanks for your replies Andrew.

  • maxaud

    I'm working on building a function to check against for 'site admins' of site_id=1.

    Do you know how I could get an array of site admin usernames for site_id 1?

    I tried:
    $site_admin_usernames = $wpdb->get_row("SELECT * FROM $wpdb->wp_sitemeta WHERE site_id = 1");
    to get the row and:
    $arrayofusernames = $site_admin_usernames->meta_value;
    to get the value but obviously something here isn't right.

  • maxaud

    Andrew,

    with this same functionality I'm needing to check if a user is a site_admin on ANY blog in the system.

    I was able to get this array:
    array(2) { [0]=> object(stdClass)#100 (1) { ["meta_value"]=> string(39) "a:2:{i:0;s:5:"adminuser";i:1;s:6:"anotheruser";}" } [1]=> object(stdClass)#74 (1) { ["meta_value"]=> string(41) "a:2:{i:0;s:5:"adminuser";i:1;s:8:"testuser";}" } }

    How would I do a check to see if a user (ex:testuser) is in the generated array?

    I tried in_array() and a couple multidimension search functions.

  • Andrew

    with this same functionality I'm needing to check if a user is a site_admin on ANY blog in the system.

    Again, blogs don't have site admins.'sites' have site admins.

    I'll assume you meant 'check if a user is a site_admin on ANY site in the system'. If that's not accurate then let me know.

    Site admins are defined in the sitemeta table. So you should just run a query getting those rows, combine the results into an array and then remove duplicates.

    How would I do a check to see if a user (ex:testuser) is in the generated array?

    Looks like you've got serialized data as the array value. Take a look at the code at the get_site_option function and the code in wpmu-options.php to see how WPMU gets an array of site admins for a site.

    Thanks,
    Andrew

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.