Make WordPress Core

Ticket #18453: 18453-2.patch

File 18453-2.patch, 2.1 KB (added by azaozz, 13 years ago)
  • wp-admin/includes/misc.php

     
    585585</fieldset>
    586586<?php
    587587}
    588 ?>
     588
     589/**
     590 * Show error message only to single site admin or network admin level users
     591 *
     592 */ 
     593function _show_errors_to_admins() {
     594        global $_admin_error_messages;
     595
     596        if ( !is_super_admin() )
     597                return;
     598
     599        if ( !empty($_admin_error_messages) ) {
     600                echo '<div class="error">';
     601
     602                foreach ( (array) $_admin_error_messages as $message ) {
     603                        echo "<p>$message</p>\n";
     604                }
     605
     606                echo "</div>\n";
     607        }
     608}
     609add_action( 'admin_notices', '_show_errors_to_admins' );
     610add_action( 'network_admin_notices', '_show_errors_to_admins' );
     611
  • wp-includes/functions.php

     
    35193519 * @param string $version The version of WordPress where the message was added.
    35203520 */
    35213521function _doing_it_wrong( $function, $message, $version ) {
     3522        global $_admin_error_messages;
    35223523
    35233524        do_action( 'doing_it_wrong_run', $function, $message, $version );
    35243525
    35253526        // Allow plugin to filter the output error trigger
    35263527        if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
    35273528                $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
    3528                 trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
     3529                $error = sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s. For more information please install a debugging plugin like <a href="http://wordpress.org/extend/plugins/debug-bar/">Debug Bar</a> or <a href="http://wordpress.org/extend/plugins/log-deprecated-notices/">Log Deprecated Notices</a>.' ), $function, $message, $version );
     3530
     3531                if ( WP_DEBUG_DISPLAY ) {
     3532                        (array) $_admin_error_messages[] = $error;
     3533                } else {
     3534                        trigger_error( $error );
     3535                }
    35293536        }
    35303537}
    35313538