From 9faae413dca6162e8a5d34e775b4b191f8a815f9 Mon Sep 17 00:00:00 2001 From: iandunn Date: Thu, 3 May 2018 17:25:21 +0000 Subject: [PATCH] Privacy: Limit Privacy Settings screen to Super Admins in Multisite. In many common Multisite use cases, the network administrator will want to set a network-wide privacy policy -- via the `privacy_policy_url` filter -- for consistency and convenience. When that's done, the Privacy Settings screen on individual sites becomes unnecessary, and may confuse administrators of those sites when they see that their changes don't have any effect on the policy link in the footer. Since we can't programatically determine which behavior the network admins would like, the safest default setting is to restrict the ability to super admins, and let them delegate it to individual site owners via a plugin, if they'd like to. Fixes #43935. Built from https://develop.svn.wordpress.org/trunk@43147 git-svn-id: http://core.svn.wordpress.org/trunk@42976 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/menu.php | 2 +- wp-admin/privacy.php | 2 +- wp-includes/capabilities.php | 1 + wp-includes/version.php | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 5b037c85f8..fd49433208 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -270,7 +270,7 @@ $menu[80] = array( __( 'Settings' ), 'manage_optio $submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' ); $submenu['options-general.php'][30] = array( __( 'Media' ), 'manage_options', 'options-media.php' ); $submenu['options-general.php'][40] = array( __( 'Permalinks' ), 'manage_options', 'options-permalink.php' ); - $submenu['options-general.php'][45] = array( __( 'Privacy' ), 'manage_options', 'privacy.php' ); + $submenu['options-general.php'][45] = array( __( 'Privacy' ), 'manage_privacy_policy', 'privacy.php' ); $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group diff --git a/wp-admin/privacy.php b/wp-admin/privacy.php index ea38c8e36a..399467e229 100644 --- a/wp-admin/privacy.php +++ b/wp-admin/privacy.php @@ -9,7 +9,7 @@ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); -if ( ! current_user_can( 'manage_options' ) ) { +if ( ! current_user_can( 'manage_privacy_policy' ) ) { wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) ); } diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index efc3dd2e4c..eb7ee7b138 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -557,6 +557,7 @@ function map_meta_cap( $cap, $user_id ) { break; case 'export_others_personal_data': case 'erase_others_personal_data': + case 'manage_privacy_policy': $caps[] = is_multisite() ? 'manage_network' : 'manage_options'; break; default: diff --git a/wp-includes/version.php b/wp-includes/version.php index c66613597b..94b7ccea38 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-43146'; +$wp_version = '5.0-alpha-43147'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.