Make WordPress Core

Ticket #18088: 18088.3.diff

File 18088.3.diff, 2.2 KB (added by flixos90, 9 years ago)
  • src/wp-admin/includes/template.php

     
    13861386 * action hook).
    13871387 *
    13881388 * @since 3.0.0
     1389 * @since 4.6.0 The function now supports getting network settings errors from a transient.
    13891390 *
    13901391 * @global array $wp_settings_errors Storage array of errors registered during this pageload
    13911392 *
     
    14041405        if ( $sanitize )
    14051406                sanitize_option( $setting, get_option( $setting ) );
    14061407
    1407         // If settings were passed back from options.php then use them.
     1408        // If settings were passed back from options.php or network/settings.php then use them.
    14081409        if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
    14091410                $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) );
    14101411                delete_transient( 'settings_errors' );
     1412        } elseif ( is_network_admin() && isset( $_GET['updated'] ) && $_GET['updated'] && get_site_transient( 'settings_errors' ) ) {
     1413                $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_site_transient( 'settings_errors' ) );
     1414                delete_site_transient( 'settings_errors' );
    14111415        }
    14121416
    14131417        // Check global in case errors have been added on this pageload.
  • src/wp-admin/network/settings.php

     
    8787         */
    8888        do_action( 'update_wpmu_options' );
    8989
     90        // If no settings errors were registered add a general 'updated' message.
     91        if ( ! count( get_settings_errors() ) ) {
     92                add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
     93        }
     94
     95        set_site_transient( 'settings_errors', get_settings_errors(), 30 );
     96
    9097        wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) );
    9198        exit();
    9299}
     
    94101include( ABSPATH . 'wp-admin/admin-header.php' );
    95102
    96103if ( isset( $_GET['updated'] ) ) {
    97         ?><div id="message" class="updated notice is-dismissible"><p><?php _e( 'Settings saved.' ) ?></p></div><?php
     104        settings_errors();
    98105}
    99106?>
    100107