Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/wp-admin/async-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@
$message,
array(
'id' => $error_description_id,
'additional_classes' => array( 'error-div', 'error' ),
'type' => 'error',
'additional_classes' => array( 'error-div' ),
'paragraph_wrap' => false,
Comment on lines 135 to 139
)
);
Expand Down
10 changes: 5 additions & 5 deletions src/wp-admin/edit-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@
wp_admin_notice(
$error_msg,
array(
'id' => 'moderated',
'additional_classes' => array( 'error' ),
'id' => 'moderated',
'type' => 'error',
)
);
}
Expand Down Expand Up @@ -420,9 +420,9 @@
wp_admin_notice(
implode( "<br />\n", $messages ),
array(
'id' => 'moderated',
'additional_classes' => array( 'updated' ),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the .updated class will definitely introduce a regression in plugin notices. A quick search shows that many plugins rely on that class to style their notices: https://veloria.dev/search/28516758-5fa1-4e88-9012-19de975fe7f0

For example, LiteSpeed Cache uses .updated directly in its notice styles:

.litespeed-wrap .notice,
.litespeed-wrap div.updated,
.litespeed-wrap div.error {
	border-left: 4px solid #fff;
	box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
	padding: 1px 12px;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mukeshpanchal27, Thanks for the review.

I am not sure on this, as per the example shared, it has div.error style is also added. So not only updated class, but also error could have effect. Because the new notice adds the class as notice notice-success or notice notice-error not notice error, so it would break for error as well.

What could be done here to not remove the additional-classes entirely instead, add the type error or success as an extra thing would be more approporate if the regression is concern.

'dismissible' => true,
'id' => 'moderated',
'type' => 'success',
'dismissible' => true,
)
);
}
Expand Down
10 changes: 5 additions & 5 deletions src/wp-admin/edit-form-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,9 @@
wp_admin_notice(
$message,
array(
'type' => 'success',
'dismissible' => true,
'id' => 'message',
'additional_classes' => array( 'updated' ),
'type' => 'success',
'dismissible' => true,
'id' => 'message',
)
);
endif;
Expand All @@ -466,7 +465,8 @@
$connection_lost_message,
array(
'id' => 'lost-connection-notice',
'additional_classes' => array( 'error', 'hidden' ),
'type' => 'error',
'additional_classes' => array( 'hidden' ),
)
);
?>
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/edit-link-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
wp_admin_notice(
__( 'Link added.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
'id' => 'message',
'type' => 'success',
'dismissible' => true,
)
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/wp-admin/edit-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,15 @@
<hr class="wp-header-end">

<?php
$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';
$type = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'success';

if ( $message ) {
wp_admin_notice(
$message,
array(
'id' => 'message',
'additional_classes' => array( $class ),
'dismissible' => true,
'type' => $type,
'id' => 'message',
'dismissible' => true,
)
);

Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@
wp_admin_notice(
implode( ' ', $messages ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
'id' => 'message',
'type' => 'success',
'dismissible' => true,
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
wp_admin_notice(
$importer_not_installed,
array(
'additional_classes' => array( 'error' ),
'type' => 'error',
)
);
endif;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-bulk-upgrader-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function after( $title = '' ) {
wp_admin_notice(
$after_error_message,
array(
'additional_classes' => array( 'error' ),
'type' => 'error',
)
);

Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/includes/class-custom-background.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ public function admin_page() {
wp_admin_notice(
$updated_message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'id' => 'message',
'type' => 'success',
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/includes/class-custom-image-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ public function step_1() {
wp_admin_notice(
$updated_message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'id' => 'message',
'type' => 'success',
)
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/wp-admin/includes/class-wp-plugin-install-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ public function no_items() {
wp_admin_notice(
$error_message,
array(
'additional_classes' => array( 'inline', 'error' ),
'type' => 'error',
'additional_classes' => array( 'inline' ),
'paragraph_wrap' => false,
)
);
Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -2520,8 +2520,8 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
wp_admin_notice(
$error_string,
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'id' => 'message',
'type' => 'error',
)
);
}
Expand Down
10 changes: 5 additions & 5 deletions src/wp-admin/includes/nav-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -1460,8 +1460,8 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
$messages[] = wp_get_admin_notice(
$menu_item_db_id->get_error_message(),
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'id' => 'message',
'type' => 'error',
)
);
} else {
Expand Down Expand Up @@ -1514,9 +1514,9 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
/* translators: %s: Nav menu title. */
$message = sprintf( __( '%s has been updated.' ), '<strong>' . $nav_menu_selected_title . '</strong>' );
$notice_args = array(
'id' => 'message',
'dismissible' => true,
'additional_classes' => array( 'updated' ),
'id' => 'message',
'dismissible' => true,
'type' => 'success',
);

$messages[] = wp_get_admin_notice( $message, $notice_args );
Expand Down
22 changes: 12 additions & 10 deletions src/wp-admin/includes/network.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function network_step1( $errors = false ) {
wp_admin_notice(
$cannot_define_constant_message,
array(
'additional_classes' => array( 'error' ),
'type' => 'error',
)
);

Expand Down Expand Up @@ -165,8 +165,8 @@ function network_step1( $errors = false ) {
wp_admin_notice(
$network_created_error_message,
array(
'additional_classes' => array( 'error' ),
'paragraph_wrap' => false,
'type' => 'error',
'paragraph_wrap' => false,
)
);
$error_codes = $errors->get_error_codes();
Expand Down Expand Up @@ -198,19 +198,19 @@ function network_step1( $errors = false ) {
} else {
$subdomain_install = false;
$got_mod_rewrite = got_mod_rewrite();
$message_class = '';
$message_type = '';
$message = '';

if ( $got_mod_rewrite ) { // Dangerous assumptions.
$message_class = 'updated';
$message_type = 'success';
$message = '<p><strong>' . __( 'Warning:' ) . '</strong> ';
$message .= '<p>' . sprintf(
/* translators: %s: mod_rewrite */
__( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
'<code>mod_rewrite</code>'
) . '</p>';
} elseif ( $is_apache ) {
$message_class = 'error';
$message_type = 'error';
$message = '<p><strong>' . __( 'Warning:' ) . '</strong> ';
$message .= sprintf(
/* translators: %s: mod_rewrite */
Expand All @@ -231,7 +231,8 @@ function network_step1( $errors = false ) {
wp_admin_notice(
$message,
array(
'additional_classes' => array( $message_class, 'inline' ),
'type' => $message_type,
'additional_classes' => array( 'inline' ),
'paragraph_wrap' => false,
)
);
Expand Down Expand Up @@ -281,7 +282,8 @@ function network_step1( $errors = false ) {
wp_admin_notice(
$subdirectory_warning_message,
array(
'additional_classes' => array( 'error', 'inline' ),
'type' => 'error',
'additional_classes' => array( 'inline' ),
)
);
}
Expand Down Expand Up @@ -432,7 +434,7 @@ function network_step2( $errors = false ) {
wp_admin_notice(
$errors->get_error_message(),
array(
'additional_classes' => array( 'error' ),
'type' => 'error',
)
);
}
Expand All @@ -455,7 +457,7 @@ function network_step2( $errors = false ) {
wp_admin_notice(
'<strong>' . __( 'Warning:' ) . '</strong> ' . __( 'An existing WordPress network was detected.' ),
array(
'additional_classes' => array( 'error' ),
'type' => 'error',
)
);
?>
Expand Down
7 changes: 4 additions & 3 deletions src/wp-admin/includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,8 @@ function wp_import_upload_form( $action ) {
wp_admin_notice(
$upload_directory_error,
array(
'additional_classes' => array( 'error' ),
'paragraph_wrap' => false,
'type' => 'error',
'paragraph_wrap' => false,
)
);
else :
Expand Down Expand Up @@ -1444,7 +1444,8 @@ function do_meta_boxes( $screen, $context, $data_object ) {
wp_admin_notice(
$meta_box_not_compatible_message,
array(
'additional_classes' => array( 'error', 'inline' ),
'type' => 'error',
'additional_classes' => array( 'inline' ),
)
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/wp-admin/includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ function default_password_nag() {
wp_admin_notice(
$default_password_nag_message,
array(
'additional_classes' => array( 'error', 'default-password-nag' ),
'type' => 'error',
'additional_classes' => array( 'default-password-nag' ),
'paragraph_wrap' => false,
)
);
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/link-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
wp_admin_notice(
$deleted_message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
'id' => 'message',
'type' => 'success',
'dismissible' => true,
)
);
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] );
Expand Down
Loading
Loading