WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/07/2017 12:52:24 PM (3 years ago)
Author:
flixos90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/capabilities.php

    r39588 r40390  
    481481        $caps[] = $cap;
    482482        break;
     483    case 'setup_network':
     484        if ( is_multisite() ) {
     485            $caps[] = 'manage_network_options';
     486        } else {
     487            $caps[] = 'manage_options';
     488        }
     489        break;
    483490    default:
    484491        // Handle meta capabilities for custom post types.
Note: See TracChangeset for help on using the changeset viewer.