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:
Helen Hou-Sandi
2015-04-01 22:05:17 +00:00
parent e5d660e597
commit 35df5592f1
35 changed files with 156 additions and 82 deletions

View File

@@ -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>';
}
?>