Skip to content

Commit d5a3a14

Browse files
committed
Administration: Update out of date error message styling.
Change several error message across core to use WordPress standard styling. Ensure only prefixes are wrapped in `strong` tags rather than the whole message, use `notice notice-error` classes where appropriate, and replace a custom error with `wp_admin_notice()` in multisite. Props afercia, rajinsharwar, robinmartijn, mukesh27, sabernhardt, oglekler, joedolson, chaion07, im3dabasia1, audrasjb, dkarfa, najmulsaju. Fixes #50402. git-svn-id: https://develop.svn.wordpress.org/trunk@59960 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 27181a7 commit d5a3a14

File tree

7 files changed

+15
-9
lines changed

7 files changed

+15
-9
lines changed

src/js/_enqueues/admin/tags.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ jQuery( function($) {
5555
$('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove();
5656

5757
} else if ( '-1' == r ) {
58-
$('#ajax-response').empty().append('<div class="error"><p>' + wp.i18n.__( 'Sorry, you are not allowed to do that.' ) + '</p></div>');
58+
$('#ajax-response').empty().append('<div class="notice notice-error"><p>' + wp.i18n.__( 'Sorry, you are not allowed to do that.' ) + '</p></div>');
5959
tr.children().css('backgroundColor', '');
6060

6161
} else {
62-
$('#ajax-response').empty().append('<div class="error"><p>' + wp.i18n.__( 'An error occurred while processing your request. Please try again later.' ) + '</p></div>');
62+
$('#ajax-response').empty().append('<div class="notice notice-error"><p>' + wp.i18n.__( 'An error occurred while processing your request. Please try again later.' ) + '</p></div>');
6363
tr.children().css('backgroundColor', '');
6464
}
6565
});

src/js/_enqueues/vendor/plupload/handlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function prepareMediaItemInit( fileObj ) {
204204

205205
// Generic error message.
206206
function wpQueueError( message ) {
207-
jQuery( '#media-upload-error' ).show().html( '<div class="error"><p>' + message + '</p></div>' );
207+
jQuery( '#media-upload-error' ).show().html( '<div class="notice notice-error"><p>' + message + '</p></div>' );
208208
}
209209

210210
// File-specific error messages.

src/js/_enqueues/wp/theme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ themes.view.Installer = themes.view.Appearance.extend({
16651665
this.listenTo( this.collection, 'query:fail', function() {
16661666
$( 'body' ).removeClass( 'loading-content' );
16671667
$( '.theme-browser' ).find( 'div.error' ).remove();
1668-
$( '.theme-browser' ).find( 'div.themes' ).before( '<div class="error"><p>' + l10n.error + '</p><p><button class="button try-again">' + l10n.tryAgain + '</button></p></div>' );
1668+
$( '.theme-browser' ).find( 'div.themes' ).before( '<div class="notice notice-error"><p>' + l10n.error + '</p><p><button class="button try-again">' + l10n.tryAgain + '</button></p></div>' );
16691669
$( '.theme-browser .error .try-again' ).on( 'click', function( e ) {
16701670
e.preventDefault();
16711671
$( 'input.wp-filter-search' ).trigger( 'input' );

src/wp-admin/includes/class-wp-ms-themes-list-table.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,14 @@ public function column_description( $theme ) {
704704
global $status, $totals;
705705

706706
if ( $theme->errors() ) {
707-
$pre = 'broken' === $status ? __( 'Broken Theme:' ) . ' ' : '';
708-
echo '<p><strong class="error-message">' . $pre . $theme->errors()->get_error_message() . '</strong></p>';
707+
$pre = 'broken' === $status ? '<strong class="error-message">' . __( 'Broken Theme:' ) . '</strong> ' : '';
708+
wp_admin_notice(
709+
$pre . $theme->errors()->get_error_message(),
710+
array(
711+
'type' => 'error',
712+
'additional_classes' => 'inline',
713+
)
714+
);
709715
}
710716

711717
if ( $this->is_site_themes ) {

src/wp-admin/includes/network.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function network_step1( $errors = false ) {
158158

159159
$error_codes = array();
160160
if ( is_wp_error( $errors ) ) {
161-
$network_created_error_message = '<p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>';
161+
$network_created_error_message = '<p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'The network could not be created.' ) . '</p>';
162162
foreach ( $errors->get_error_messages() as $error ) {
163163
$network_created_error_message .= "<p>$error</p>";
164164
}

src/wp-admin/themes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@
345345

346346
if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
347347
wp_admin_notice(
348-
__( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message(),
348+
'<strong>' . __( 'Error:' ) . '</strong> ' . $current_theme->errors()->get_error_message(),
349349
array(
350350
'additional_classes' => array( 'error' ),
351351
)

src/wp-signup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function wpmu_signup_stylesheet() {
6868
.mu_register form { margin-top: 2em; }
6969
.mu_register fieldset,
7070
.mu_register legend { margin: 0; padding: 0; border: none; }
71-
.mu_register .error { font-weight: 600; padding: 10px; color: #333; background: #ffebe8; border: 1px solid #c00; }
71+
.mu_register .error { padding: 10px; color: #333; background: #ffebe8; border: 1px solid #c00; }
7272
.mu_register input[type="submit"],
7373
.mu_register #blog_title,
7474
.mu_register #user_email,

0 commit comments

Comments
 (0)