Make WordPress Core

Ticket #30927: 0001-Return-403-responses.patch

File 0001-Return-403-responses.patch, 2.2 KB (added by tomdxw, 11 years ago)
  • wp-admin/includes/menu.php

    From 384cbb5b1091fe74753653d1124a3f4707bf108e Mon Sep 17 00:00:00 2001
    From: Tom Adams <tom@dxw.com>
    Date: Mon, 5 Jan 2015 16:57:00 -0500
    Subject: [PATCH] Return 403 responses
    
    ---
     wp-admin/includes/menu.php | 2 +-
     wp-admin/includes/ms.php   | 4 ++--
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/wp-admin/includes/menu.php b/wp-admin/includes/menu.php
    index 873f737..41de27c 100644
    a b if ( !user_can_access_admin_page() ) { 
    316316         */
    317317        do_action( 'admin_page_access_denied' );
    318318
    319         wp_die( __('You do not have sufficient permissions to access this page.') );
     319        wp_die( __('You do not have sufficient permissions to access this page.'), 403 );
    320320}
    321321
    322322$menu = add_menu_classes($menu);
  • wp-admin/includes/ms.php

    diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php
    index a9c62bb..c466bc3 100644
    a b function _access_denied_splash() { 
    624624        $blog_name = get_bloginfo( 'name' );
    625625
    626626        if ( empty( $blogs ) )
    627                 wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) );
     627                wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 );
    628628
    629629        $output = '<p>' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '</p>';
    630630        $output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
    function _access_denied_splash() { 
    642642
    643643        $output .= '</table>';
    644644
    645         wp_die( $output );
     645        wp_die( $output, 403 );
    646646}
    647647add_action( 'admin_page_access_denied', '_access_denied_splash', 99 );
    648648