Introduce delete_site meta capability.
Map `delete_site` as a meta capability to `manage_options` so that the ability to delete sites can be more granularly managed for individual site administrators on a multisite network. Props thomaswm. Fixes #30470. Built from https://develop.svn.wordpress.org/trunk@31673 git-svn-id: http://core.svn.wordpress.org/trunk@31654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c1cab11ceb
commit
b5b5c98e0a
|
@ -228,7 +228,7 @@ $menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-ic
|
|||
$submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
|
||||
$submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' );
|
||||
if ( is_multisite() && !is_main_site() )
|
||||
$submenu['tools.php'][25] = array( __('Delete Site'), 'manage_options', 'ms-delete-site.php' );
|
||||
$submenu['tools.php'][25] = array( __('Delete Site'), 'delete_site', 'ms-delete-site.php' );
|
||||
if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )
|
||||
$submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ require_once( dirname( __FILE__ ) . '/admin.php' );
|
|||
if ( !is_multisite() )
|
||||
wp_die( __( 'Multisite support is not enabled.' ) );
|
||||
|
||||
// @todo Create a delete blog cap.
|
||||
if ( ! current_user_can( 'manage_options' ) )
|
||||
if ( ! current_user_can( 'delete_site' ) )
|
||||
wp_die(__( 'You do not have sufficient permissions to delete this site.'));
|
||||
|
||||
if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) {
|
||||
|
|
|
@ -1345,6 +1345,9 @@ function map_meta_cap( $cap, $user_id ) {
|
|||
case 'customize' :
|
||||
$caps[] = 'edit_theme_options';
|
||||
break;
|
||||
case 'delete_site':
|
||||
$caps[] = 'manage_options';
|
||||
break;
|
||||
default:
|
||||
// Handle meta capabilities for custom post types.
|
||||
$post_type_meta_caps = _post_type_meta_capabilities();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31672';
|
||||
$wp_version = '4.2-alpha-31673';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue