Return HTTP status code 403 in network admin when access is forbidden.

When the error message "You do not have permission to access this page" is used in network admin screens, return an HTTP status code of 403 to match. Previously: [30356] and [31300].

Props yo-l1982.

Fixes #31422.


git-svn-id: https://develop.svn.wordpress.org/trunk@31658 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2015-03-07 05:59:17 +00:00
parent 03b4e1f0aa
commit a5fcc34a50
10 changed files with 15 additions and 15 deletions
+5 -5
View File
@@ -14,7 +14,7 @@ if ( ! is_multisite() )
wp_die( __( 'Multisite support is not enabled.' ) );
if ( ! current_user_can( 'manage_network_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
function confirm_delete_users( $users ) {
$current_user = wp_get_current_user();
@@ -123,7 +123,7 @@ if ( isset( $_GET['action'] ) ) {
switch ( $_GET['action'] ) {
case 'deleteuser':
if ( ! current_user_can( 'manage_network_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
check_admin_referer( 'deleteuser' );
@@ -144,7 +144,7 @@ if ( isset( $_GET['action'] ) ) {
case 'allusers':
if ( !current_user_can( 'manage_network_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) {
check_admin_referer( 'bulk-users-network' );
@@ -157,7 +157,7 @@ if ( isset( $_GET['action'] ) ) {
switch ( $doaction ) {
case 'delete':
if ( ! current_user_can( 'delete_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
$title = __( 'Users' );
$parent_file = 'users.php';
require_once( ABSPATH . 'wp-admin/admin-header.php' );
@@ -206,7 +206,7 @@ if ( isset( $_GET['action'] ) ) {
case 'dodelete':
check_admin_referer( 'ms-users-delete' );
if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) )
wp_die( __( 'You do not have permission to access this page.' ) );
wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) {
foreach ( $_POST['blog'] as $id => $users ) {