mushroom
mushroom

Reputation: 1945

WordPress Roles and Capabilities on a network-wide setup

I'm trying to understand how Roles and Capabilities work on a network-wide setup.

And examination of /wp-includes/capabilities.php show that a there is a function called current_user_can_for_blog($blog_id, $capability).

My question therefore is, in a network-wide setup involving many blogs, user X could be the administrator for blogs #1 and #2 but not for blogs #3, #4 and #5.

If I simply use current_user_can('manage_options'), how would that work out for user X on blogs #3, #4 and #5?

Upvotes: 1

Views: 197

Answers (1)

Pete
Pete

Reputation: 68

As I understand it, if you're using current_user_can('manage_options') within a plugin or theme to provide a different set of options to a site admin, whatever you're attaching this function to will only show up if a user has been designated as an administrator for blog #1 and #2 (this can be tweaked with user role capability plugins however).

If they haven't been designated as a user (or admin) on the other sites (#3, #4 and #5), they shouldn't be able to access the actions related to this hook.

That said however, a super-admin user (that can oversee the entire network) has complete control, and can access these functions, irrespective of whether they have been added to an individual site or not.

Upvotes: 1

Related Questions