mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Admin notices: Make (most) core notices dismissible.
These no longer return upon refreshing the page when JS is on and working, so users should be able to dismiss them. This is particularly important on the post edit screen when DFW is triggered, but pretty much all notices can be dismissed if needed. A post on Make/Core will follow with information on how this can be leveraged in plugins. props valendesigns, afercia, paulwilde, adamsilverstein, helen. fixes #31233. see #23367. git-svn-id: https://develop.svn.wordpress.org/trunk@31973 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -114,7 +114,7 @@ if ( $_POST ) {
|
||||
include( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
|
||||
if ( isset( $_GET['updated'] ) ) {
|
||||
?><div id="message" class="updated"><p><?php _e( 'Options saved.' ) ?></p></div><?php
|
||||
?><div id="message" class="updated notice is-dismissible"><p><?php _e( 'Options saved.' ) ?></p></div><?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ foreach ( $tabs as $tab_id => $tab ) {
|
||||
<?php
|
||||
if ( ! empty( $messages ) ) {
|
||||
foreach ( $messages as $msg )
|
||||
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
|
||||
} ?>
|
||||
<form method="post" action="site-info.php?action=update-site">
|
||||
<?php wp_nonce_field( 'edit-site' ); ?>
|
||||
|
||||
@@ -134,7 +134,7 @@ require( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
<?php
|
||||
if ( ! empty( $messages ) ) {
|
||||
foreach ( $messages as $msg )
|
||||
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
|
||||
} ?>
|
||||
<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate">
|
||||
<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?>
|
||||
|
||||
@@ -105,7 +105,7 @@ foreach ( $tabs as $tab_id => $tab ) {
|
||||
<?php
|
||||
if ( ! empty( $messages ) ) {
|
||||
foreach ( $messages as $msg )
|
||||
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
|
||||
} ?>
|
||||
<form method="post" action="site-settings.php?action=update-site">
|
||||
<?php wp_nonce_field( 'edit-site' ); ?>
|
||||
|
||||
@@ -157,12 +157,12 @@ foreach ( $tabs as $tab_id => $tab ) {
|
||||
|
||||
if ( isset( $_GET['enabled'] ) ) {
|
||||
$_GET['enabled'] = absint( $_GET['enabled'] );
|
||||
echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
|
||||
} elseif ( isset( $_GET['disabled'] ) ) {
|
||||
$_GET['disabled'] = absint( $_GET['disabled'] );
|
||||
echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
|
||||
} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
|
||||
echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
|
||||
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
|
||||
} ?>
|
||||
|
||||
<p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p>
|
||||
|
||||
@@ -201,34 +201,34 @@ foreach ( $tabs as $tab_id => $tab ) {
|
||||
if ( isset($_GET['update']) ) :
|
||||
switch($_GET['update']) {
|
||||
case 'adduser':
|
||||
echo '<div id="message" class="updated"><p>' . __( 'User added.' ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User added.' ) . '</p></div>';
|
||||
break;
|
||||
case 'err_add_member':
|
||||
echo '<div id="message" class="error"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
|
||||
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
|
||||
break;
|
||||
case 'err_add_notfound':
|
||||
echo '<div id="message" class="error"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
|
||||
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
|
||||
break;
|
||||
case 'promote':
|
||||
echo '<div id="message" class="updated"><p>' . __( 'Changed roles.' ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
|
||||
break;
|
||||
case 'err_promote':
|
||||
echo '<div id="message" class="error"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
|
||||
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
|
||||
break;
|
||||
case 'remove':
|
||||
echo '<div id="message" class="updated"><p>' . __( 'User removed from this site.' ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>';
|
||||
break;
|
||||
case 'err_remove':
|
||||
echo '<div id="message" class="error"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
|
||||
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
|
||||
break;
|
||||
case 'newuser':
|
||||
echo '<div id="message" class="updated"><p>' . __( 'User created.' ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User created.' ) . '</p></div>';
|
||||
break;
|
||||
case 'err_new':
|
||||
echo '<div id="message" class="error"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
|
||||
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
|
||||
break;
|
||||
case 'err_new_dup':
|
||||
echo '<div id="message" class="error"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
|
||||
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
|
||||
break;
|
||||
}
|
||||
endif; ?>
|
||||
|
||||
@@ -239,7 +239,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
}
|
||||
|
||||
if ( ! empty( $msg ) )
|
||||
$msg = '<div class="updated" id="message"><p>' . $msg . '</p></div>';
|
||||
$msg = '<div class="updated" id="message notice is-dismissible"><p>' . $msg . '</p></div>';
|
||||
}
|
||||
|
||||
$wp_list_table->prepare_items();
|
||||
|
||||
@@ -274,7 +274,7 @@ if ( isset( $_GET['enabled'] ) ) {
|
||||
} else {
|
||||
$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
|
||||
}
|
||||
echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
|
||||
} elseif ( isset( $_GET['disabled'] ) ) {
|
||||
$disabled = absint( $_GET['disabled'] );
|
||||
if ( 1 == $disabled ) {
|
||||
@@ -282,7 +282,7 @@ if ( isset( $_GET['enabled'] ) ) {
|
||||
} else {
|
||||
$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
|
||||
}
|
||||
echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
|
||||
} elseif ( isset( $_GET['deleted'] ) ) {
|
||||
$deleted = absint( $_GET['deleted'] );
|
||||
if ( 1 == $deleted ) {
|
||||
@@ -290,11 +290,11 @@ if ( isset( $_GET['enabled'] ) ) {
|
||||
} else {
|
||||
$message = _n( '%s theme deleted.', '%s themes deleted.', $deleted );
|
||||
}
|
||||
echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
|
||||
} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
|
||||
echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
|
||||
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
|
||||
} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) {
|
||||
echo '<div class="error"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
|
||||
echo '<div class="error notice is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -73,7 +73,7 @@ require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
|
||||
<?php
|
||||
if ( ! empty( $messages ) ) {
|
||||
foreach ( $messages as $msg )
|
||||
echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
|
||||
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
|
||||
}
|
||||
|
||||
if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?>
|
||||
|
||||
@@ -280,7 +280,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
|
||||
if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) {
|
||||
?>
|
||||
<div id="message" class="updated"><p>
|
||||
<div id="message" class="updated notice is-dismissible"><p>
|
||||
<?php
|
||||
switch ( $_REQUEST['action'] ) {
|
||||
case 'delete':
|
||||
|
||||
Reference in New Issue
Block a user