mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Multisite: Introduce a setup_network capability for setting up multisite.
`setup_network` is a new meta capability that brings more granular control over the permissions to setup a multisite environment. In a non-multisite environment it falls back to `manage_options` while in a multisite it falls back to `manage_network_options`. The introduction of this capability furthermore allows replacing an `is_super_admin()` check. Props ashokkumar24 for the original patch. Fixes #39206. See #37616. git-svn-id: https://develop.svn.wordpress.org/trunk@40390 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -480,6 +480,13 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
case 'manage_network_options':
|
||||
$caps[] = $cap;
|
||||
break;
|
||||
case 'setup_network':
|
||||
if ( is_multisite() ) {
|
||||
$caps[] = 'manage_network_options';
|
||||
} else {
|
||||
$caps[] = 'manage_options';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Handle meta capabilities for custom post types.
|
||||
global $post_type_meta_caps;
|
||||
|
||||
Reference in New Issue
Block a user