Networks and Sites: Use consistent markup for admin notices.

Fix admin notices in network screens so they use consistent markup and style.

Props afercia, marksabbath, stevenkword, jeremyfelt, aryamaaru, robinwpdeveloper, obayedmamur, joedolson.
Fixes #39213.
Built from https://develop.svn.wordpress.org/trunk@55418


git-svn-id: http://core.svn.wordpress.org/trunk@54951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2023-02-23 22:13:23 +00:00
parent 259af07d2b
commit f51b63c1fe
12 changed files with 39 additions and 43 deletions

View File

@ -56,7 +56,7 @@ get_current_screen()->set_help_sidebar(
require_once ABSPATH . 'wp-admin/admin-header.php';
if ( $updated ) { ?>
<div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
<div id="message" class="notice notice-success is-dismissible"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
<?php } ?>
<div class="wrap">
@ -74,9 +74,9 @@ if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ), true )
}
if ( empty( $blogs ) ) :
echo '<p>';
_e( 'You must be a member of at least one site to use this page.' );
echo '</p>';
?>
<div class="notice notice-error is-dismissible"><p><strong><?php _e( 'You must be a member of at least one site to use this page.' ); ?></strong></p></div>
<?php
else :
?>

View File

@ -138,7 +138,7 @@ if ( $_POST ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
if ( isset( $_GET['updated'] ) ) {
?><div id="message" class="updated notice is-dismissible"><p><?php _e( 'Settings saved.' ); ?></p></div>
?><div id="message" class="notice notice-success is-dismissible"><p><?php _e( 'Settings saved.' ); ?></p></div>
<?php
}
?>
@ -167,7 +167,7 @@ if ( isset( $_GET['updated'] ) ) {
$new_admin_email = get_site_option( 'new_admin_email' );
if ( $new_admin_email && get_site_option( 'admin_email' ) !== $new_admin_email ) :
?>
<div class="updated inline">
<div class="notice notice-warning is-dismissible inline">
<p>
<?php
printf(

View File

@ -147,7 +147,7 @@ network_edit_site_nav(
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg ) {
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . $msg . '</p></div>';
}
}
?>

View File

@ -189,7 +189,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
<?php
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg ) {
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . $msg . '</p></div>';
}
}
?>

View File

@ -105,7 +105,7 @@ network_edit_site_nav(
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg ) {
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . $msg . '</p></div>';
}
}
?>

View File

@ -195,7 +195,7 @@ if ( isset( $_GET['enabled'] ) ) {
/* translators: %s: Number of themes. */
$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
} elseif ( isset( $_GET['disabled'] ) ) {
$disabled = absint( $_GET['disabled'] );
if ( 1 === $disabled ) {
@ -204,9 +204,9 @@ if ( isset( $_GET['enabled'] ) ) {
/* translators: %s: Number of themes. */
$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
} elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) {
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
}
?>

View File

@ -235,37 +235,37 @@ network_edit_site_nav(
if ( isset( $_GET['update'] ) ) :
switch ( $_GET['update'] ) {
case 'adduser':
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User added.' ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . __( 'User added.' ) . '</p></div>';
break;
case 'err_add_member':
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
break;
case 'err_add_fail':
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User could not be added to this site.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'User could not be added to this site.' ) . '</p></div>';
break;
case 'err_add_notfound':
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
break;
case 'promote':
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
break;
case 'err_promote':
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
break;
case 'remove':
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>';
break;
case 'err_remove':
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
break;
case 'newuser':
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User created.' ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . __( 'User created.' ) . '</p></div>';
break;
case 'err_new':
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
break;
case 'err_new_dup':
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
break;
}
endif;

View File

@ -354,7 +354,7 @@ if ( isset( $_GET['updated'] ) ) {
}
if ( ! empty( $msg ) ) {
$msg = '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
$msg = '<div id="message" class="notice notice-success is-dismissible"><p>' . $msg . '</p></div>';
}
}

View File

@ -375,7 +375,7 @@ if ( isset( $_GET['enabled'] ) ) {
/* translators: %s: Number of themes. */
$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
echo '<div id="message" class="notice notice-updated is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
} elseif ( isset( $_GET['disabled'] ) ) {
$disabled = absint( $_GET['disabled'] );
if ( 1 === $disabled ) {
@ -384,7 +384,7 @@ if ( isset( $_GET['enabled'] ) ) {
/* translators: %s: Number of themes. */
$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
echo '<div id="message" class="notice notice-updated is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
} elseif ( isset( $_GET['deleted'] ) ) {
$deleted = absint( $_GET['deleted'] );
if ( 1 === $deleted ) {
@ -393,7 +393,7 @@ if ( isset( $_GET['enabled'] ) ) {
/* translators: %s: Number of themes. */
$message = _n( '%s theme deleted.', '%s themes deleted.', $deleted );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
$enabled = absint( $_GET['enabled-auto-update'] );
if ( 1 === $enabled ) {
@ -402,7 +402,7 @@ if ( isset( $_GET['enabled'] ) ) {
/* translators: %s: Number of themes. */
$message = _n( '%s theme will be auto-updated.', '%s themes will be auto-updated.', $enabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
} elseif ( isset( $_GET['disabled-auto-update'] ) ) {
$disabled = absint( $_GET['disabled-auto-update'] );
if ( 1 === $disabled ) {
@ -411,11 +411,11 @@ if ( isset( $_GET['enabled'] ) ) {
/* translators: %s: Number of themes. */
$message = _n( '%s theme will no longer be auto-updated.', '%s themes will no longer be auto-updated.', $disabled );
}
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
} elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) {
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
} elseif ( isset( $_GET['error'] ) && 'main' === $_GET['error'] ) {
echo '<div class="error notice is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
}
?>

View File

@ -77,8 +77,8 @@ if ( isset( $_REQUEST['action'] ) && 'add-user' === $_REQUEST['action'] ) {
}
}
$message = '';
if ( isset( $_GET['update'] ) ) {
$messages = array();
if ( 'added' === $_GET['update'] ) {
$edit_link = '';
if ( isset( $_GET['user_id'] ) ) {
@ -93,8 +93,6 @@ if ( isset( $_GET['update'] ) ) {
if ( $edit_link ) {
$message .= sprintf( ' <a href="%s">%s</a>', $edit_link, __( 'Edit user' ) );
}
$messages[] = $message;
}
}
@ -107,18 +105,16 @@ require_once ABSPATH . 'wp-admin/admin-header.php'; ?>
<div class="wrap">
<h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1>
<?php
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg ) {
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
}
if ( '' !== $message ) {
echo '<div id="message" class="notice notice-success is-dismissible"><p>' . $message . '</p></div>';
}
if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) {
?>
<div class="error">
<div id="message" class="notice notice-error is-dismissible">
<?php
foreach ( $add_user_errors->get_error_messages() as $message ) {
echo "<p>$message</p>";
foreach ( $add_user_errors->get_error_messages() as $error ) {
echo "<p>$error</p>";
}
?>
</div>

View File

@ -255,7 +255,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
if ( isset( $_REQUEST['updated'] ) && 'true' == $_REQUEST['updated'] && ! empty( $_REQUEST['action'] ) ) {
?>
<div id="message" class="updated notice is-dismissible"><p>
<div id="message" class="notice notice-success is-dismissible"><p>
<?php
switch ( $_REQUEST['action'] ) {
case 'delete':

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-beta3-55417';
$wp_version = '6.2-beta3-55418';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.