mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@31673 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user