Make WordPress Core

Changeset 39494


Ignore:
Timestamp:
12/04/2016 10:06:36 PM (8 years ago)
Author:
johnbillion
Message:

Role/Capability: Don't assign the delete_site capability to anyone on single site installs.

This capability is not relevant on single site installs; it only applies to deleting a site on a multisite installation.

Fixes #38326

Location:
trunk
Files:
2 edited

Legend:

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

    r39464 r39494  
    423423        break;
    424424    case 'delete_site':
    425         $caps[] = 'manage_options';
     425        if ( is_multisite() ) {
     426            $caps[] = 'manage_options';
     427        } else {
     428            $caps[] = 'do_not_allow';
     429        }
    426430        break;
    427431    case 'edit_term':
  • trunk/tests/phpunit/tests/user/capabilities.php

    r39179 r39494  
    226226            'manage_network_themes'  => array(),
    227227            'manage_network_options' => array(),
     228            'delete_site'            => array(),
    228229
    229230            'upload_plugins'         => array( 'administrator' ),
    230231            'upload_themes'          => array( 'administrator' ),
    231232            'customize'              => array( 'administrator' ),
    232             'delete_site'            => array( 'administrator' ),
    233233            'add_users'              => array( 'administrator' ),
    234234
Note: See TracChangeset for help on using the changeset viewer.