Administration: Use `wp_admin_notice()` for `.updated`.

Add usages of `wp_admin_notice()` and `wp_get_admin_notice()` on `.updated` in the root level of `/wp-admin/`. Ongoing task to implement new function across core.

Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56573


git-svn-id: http://core.svn.wordpress.org/trunk@56085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2023-09-14 02:15:17 +00:00
parent d2cc86d508
commit 768f51f60c
14 changed files with 430 additions and 182 deletions

View File

@ -411,9 +411,13 @@ if ( isset( $_REQUEST['approved'] )
}
}
printf(
'<div id="moderated" class="updated notice is-dismissible"><p>%s</p></div>',
implode( "<br />\n", $messages )
wp_admin(
implode( "<br />\n", $messages ),
array(
'id' => 'moderated',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
}

View File

@ -91,9 +91,18 @@ echo esc_html( $title );
<hr class="wp-header-end">
<?php if ( isset( $_GET['added'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Link added.' ); ?></p></div>
<?php endif; ?>
<?php
if ( isset( $_GET['added'] ) ) {
wp_admin_notice(
__( 'Link added.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
?>
<form name="<?php echo esc_attr( $form_name ); ?>" id="<?php echo esc_attr( $form_name ); ?>" method="post" action="link.php">
<?php

View File

@ -469,9 +469,13 @@ foreach ( $bulk_counts as $message => $count ) {
}
if ( $messages ) {
printf(
'<div id="message" class="updated notice is-dismissible"><p>%s</p></div>',
implode( ' ', $messages )
wp_admin_notice(
implode( ' ', $messages ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
unset( $messages );

View File

@ -119,11 +119,17 @@ if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
<?php
if ( isset( $_REQUEST['deleted'] ) ) {
echo '<div id="message" class="updated notice is-dismissible"><p>';
$deleted = (int) $_REQUEST['deleted'];
/* translators: %s: Number of links. */
printf( _n( '%s link deleted.', '%s links deleted.', $deleted ), $deleted );
echo '</p></div>';
$deleted_message = sprintf( _n( '%s link deleted.', '%s links deleted.', $deleted ), $deleted );
wp_admin_notice(
$deleted_message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] );
}
?>

View File

@ -281,7 +281,14 @@ switch ( $action ) {
check_admin_referer( 'delete-menu_item_' . $menu_item_id );
if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) {
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'The menu item has been successfully deleted.' ) . '</p></div>';
$messages[] = wp_get_admin_notice(
__( 'The menu item has been successfully deleted.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
break;
@ -302,9 +309,23 @@ switch ( $action ) {
}
if ( is_wp_error( $deletion ) ) {
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>';
$messages[] = wp_get_admin_notice(
$deletion->get_error_message(),
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'dismissible' => true,
)
);
} else {
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>';
$messages[] = wp_get_admin_notice(
__( 'The menu has been successfully deleted.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
break;
@ -320,13 +341,27 @@ switch ( $action ) {
$deletion = wp_delete_nav_menu( $menu_id_to_delete );
if ( is_wp_error( $deletion ) ) {
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>';
$messages[] = wp_get_admin_notice(
$deletion->get_error_message(),
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'dismissible' => true,
)
);
$deletion_error = true;
}
}
if ( empty( $deletion_error ) ) {
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>';
$messages[] = wp_get_admin_notice(
__( 'Selected menus have been successfully deleted.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
break;
@ -431,7 +466,14 @@ switch ( $action ) {
if ( is_wp_error( $_nav_menu_selected_id ) ) {
$_menu_object = $_nav_menu_selected_id;
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';
$messages[] = wp_get_admin_notice(
$_nav_menu_selected_id->get_error_message(),
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'dismissible' => true,
)
);
} else {
$_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
$nav_menu_selected_title = $_menu_object->name;
@ -614,11 +656,19 @@ wp_nav_menu_setup();
wp_initial_nav_menu_meta_boxes();
if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) {
$messages[] = '<div id="message" class="updated"><p>' . sprintf(
$message_no_theme_support = sprintf(
/* translators: %s: URL to Widgets screen. */
__( 'Your theme does not natively support menus, but you can use them in sidebars by adding a &#8220;Navigation Menu&#8221; widget on the <a href="%s">Widgets</a> screen.' ),
admin_url( 'widgets.php' )
) . '</p></div>';
);
$messages[] = wp_get_admin_notice(
$message_no_theme_support,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
if ( ! $locations_screen ) : // Main tab.

View File

@ -139,25 +139,25 @@ if ( ! is_multisite() ) {
<p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this, an email will be sent to your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p>
<?php
$new_admin_email = get_option( 'new_admin_email' );
if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) :
?>
<div class="updated inline">
<p>
<?php
printf(
if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) {
$pending_admin_email_message = sprintf(
/* translators: %s: New admin email. */
__( 'There is a pending change of the admin email to %s.' ),
'<code>' . esc_html( $new_admin_email ) . '</code>'
);
printf(
$pending_admin_email_message .= sprintf(
' <a href="%1$s">%2$s</a>',
esc_url( wp_nonce_url( admin_url( 'options.php?dismiss=new_admin_email' ), 'dismiss-' . get_current_blog_id() . '-new_admin_email' ) ),
__( 'Cancel' )
);
?>
</p>
</div>
<?php endif; ?>
wp_admin_notice(
$pending_admin_email_message,
array(
'additional_classes' => array( 'updated', 'inline' ),
)
);
}
?>
</td>
</tr>

View File

@ -618,7 +618,7 @@ if ( ! empty( $invalid ) ) {
}
}
if ( isset( $_GET['error'] ) ) :
if ( isset( $_GET['error'] ) ) {
if ( isset( $_GET['main'] ) ) {
$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
@ -639,10 +639,6 @@ if ( isset( $_GET['error'] ) ) :
$errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' );
}
?>
<div id="message" class="error"><p><?php echo $errmsg; ?></p>
<?php
if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] )
&& isset( $_GET['_error_nonce'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin )
) {
@ -655,66 +651,71 @@ if ( isset( $_GET['error'] ) ) :
admin_url( 'plugins.php' )
);
?>
<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe>
<?php
$errmsg .= '<iframe style="border:0" width="100%" height="70px" src="' . esc_url( $iframe_url ) . '"></iframe>';
}
?>
</div>
<?php
elseif ( isset( $_GET['deleted'] ) ) :
wp_admin_notice(
$errmsg,
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
)
);
} elseif ( isset( $_GET['deleted'] ) ) {
$delete_result = get_transient( 'plugins_delete_result_' . $user_ID );
// Delete it once we're done.
delete_transient( 'plugins_delete_result_' . $user_ID );
if ( is_wp_error( $delete_result ) ) :
?>
<div id="message" class="error notice is-dismissible">
<p>
<?php
printf(
if ( is_wp_error( $delete_result ) ) {
$plugin_not_deleted_message = sprintf(
/* translators: %s: Error message. */
__( 'Plugin could not be deleted due to an error: %s' ),
esc_html( $delete_result->get_error_message() )
);
?>
</p>
</div>
<?php else : ?>
<div id="message" class="updated notice is-dismissible">
<p>
<?php
if ( 1 === (int) $_GET['deleted'] ) {
_e( 'The selected plugin has been deleted.' );
wp_admin_notice(
$plugin_not_deleted_message,
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'dismissible' => true,
)
);
} else {
_e( 'The selected plugins have been deleted.' );
$updated_args = array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
);
if ( 1 === (int) $_GET['deleted'] ) {
$plugins_deleted_message = __( 'The selected plugin has been deleted.' );
} else {
$plugins_deleted_message = __( 'The selected plugins have been deleted.' );
}
?>
</p>
</div>
<?php endif; ?>
<?php elseif ( isset( $_GET['activate'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin activated.' ); ?></p></div>
<?php elseif ( isset( $_GET['activate-multi'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins activated.' ); ?></p></div>
<?php elseif ( isset( $_GET['deactivate'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin deactivated.' ); ?></p></div>
<?php elseif ( isset( $_GET['deactivate-multi'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins deactivated.' ); ?></p></div>
<?php elseif ( 'update-selected' === $action ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'All selected plugins are up to date.' ); ?></p></div>
<?php elseif ( isset( $_GET['resume'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin resumed.' ); ?></p></div>
<?php elseif ( isset( $_GET['enabled-auto-update'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin will be auto-updated.' ); ?></p></div>
<?php elseif ( isset( $_GET['disabled-auto-update'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin will no longer be auto-updated.' ); ?></p></div>
<?php elseif ( isset( $_GET['enabled-auto-update-multi'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins will be auto-updated.' ); ?></p></div>
<?php elseif ( isset( $_GET['disabled-auto-update-multi'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins will no longer be auto-updated.' ); ?></p></div>
<?php endif; ?>
wp_admin_notice( $plugins_deleted_message, $updated_args );
}
} elseif ( isset( $_GET['activate'] ) ) {
wp_admin_notice( __( 'Plugin activated.' ), $updated_args );
} elseif ( isset( $_GET['activate-multi'] ) ) {
wp_admin_notice( __( 'Selected plugins activated.' ), $updated_args );
} elseif ( isset( $_GET['deactivate'] ) ) {
wp_admin_notice( __( 'Plugin deactivated.' ), $updated_args );
} elseif ( isset( $_GET['deactivate-multi'] ) ) {
wp_admin_notice( __( 'Selected plugins deactivated.' ), $updated_args );
} elseif ( 'update-selected' === $action ) {
wp_admin_notice( __( 'All selected plugins are up to date.' ), $updated_args );
} elseif ( isset( $_GET['resume'] ) ) {
wp_admin_notice( __( 'Plugin resumed.' ), $updated_args );
} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
wp_admin_notice( __( 'Plugin will be auto-updated.' ), $updated_args );
} elseif ( isset( $_GET['disabled-auto-update'] ) ) {
wp_admin_notice( __( 'Plugin will no longer be auto-updated.' ), $updated_args );
} elseif ( isset( $_GET['enabled-auto-update-multi'] ) ) {
wp_admin_notice( __( 'Selected plugins will be auto-updated.' ), $updated_args );
} elseif ( isset( $_GET['disabled-auto-update-multi'] ) ) {
wp_admin_notice( __( 'Selected plugins will no longer be auto-updated.' ), $updated_args );
}
?>
<div class="wrap">
<h1 class="wp-heading-inline">

View File

@ -260,43 +260,86 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
<hr class="wp-header-end">
<?php
if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) {
?>
<div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div>
<?php
wp_admin_notice(
__( 'The active theme is broken. Reverting to the default theme.' ),
array(
'id' => 'message1',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
} elseif ( isset( $_GET['activated'] ) ) {
if ( isset( $_GET['previewed'] ) ) {
?>
<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
<?php
wp_admin_notice(
__( 'Settings saved and theme activated.' ) . '<a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>',
array(
'id' => 'message2',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
} else {
?>
<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
<?php
wp_admin_notice(
__( 'New theme activated.' ) . '<a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>',
array(
'id' => 'message2',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
} elseif ( isset( $_GET['deleted'] ) ) {
?>
<div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div>
<?php
wp_admin_notice(
__( 'Theme deleted.' ),
array(
'id' => 'message3',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
} elseif ( isset( $_GET['delete-active-child'] ) ) {
?>
<div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div>
<?php
wp_admin_notice(
__( 'You cannot delete a theme while it has an active child theme.' ),
array(
'id' => 'message4',
'additional_classes' => array( 'error' ),
)
);
} elseif ( isset( $_GET['resumed'] ) ) {
?>
<div id="message5" class="updated notice is-dismissible"><p><?php _e( 'Theme resumed.' ); ?></p></div>
<?php
wp_admin_notice(
__( 'Theme resumed.' ),
array(
'id' => 'message5',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
} elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) {
?>
<div id="message6" class="error"><p><?php _e( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ); ?></p></div>
<?php
wp_admin_notice(
__( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ),
array(
'id' => 'message6',
'additional_classes' => array( 'error' ),
)
);
} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
?>
<div id="message7" class="updated notice is-dismissible"><p><?php _e( 'Theme will be auto-updated.' ); ?></p></div>
<?php
wp_admin_notice(
__( 'Theme will be auto-updated.' ),
array(
'id' => 'message7',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
} elseif ( isset( $_GET['disabled-auto-update'] ) ) {
?>
<div id="message8" class="updated notice is-dismissible"><p><?php _e( 'Theme will no longer be auto-updated.' ); ?></p></div>
<?php
wp_admin_notice(
__( 'Theme will no longer be auto-updated.' ),
array(
'id' => 'message8',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
$current_theme = wp_get_theme();

View File

@ -218,21 +218,41 @@ if ( 'grid' === $mode ) {
<hr class="wp-header-end">
<?php if ( ! empty( $message ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
<?php endif; ?>
<div class="error hide-if-js">
<p>
<?php
printf(
if ( ! empty( $message ) ) {
wp_admin_notice(
$message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
if ( ! empty( $message ) ) {
wp_admin_notice(
$message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
$js_required_message = sprintf(
/* translators: %s: List view URL. */
__( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ),
'upload.php?mode=list'
);
wp_admin_notice(
$js_required_message,
array(
additional_classes( 'error', 'hide-if-js' ),
)
);
?>
</p>
</div>
</div>
<?php
require_once ABSPATH . 'wp-admin/admin-footer.php';
@ -426,9 +446,18 @@ if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
<hr class="wp-header-end">
<?php if ( ! empty( $message ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
<?php endif; ?>
<?php
if ( ! empty( $message ) ) {
wp_admin_notice(
$message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
?>
<form id="posts-filter" method="get">

View File

@ -545,25 +545,28 @@ switch ( $action ) {
</p>
<?php endif; ?>
<?php $new_email = get_user_meta( $current_user->ID, '_new_email', true ); ?>
<?php if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profile_user->ID === $current_user->ID ) : ?>
<div class="updated inline">
<p>
<?php
printf(
$new_email = get_user_meta( $current_user->ID, '_new_email', true );
if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profile_user->ID === $current_user->ID ) :
$pending_change_message = sprintf(
/* translators: %s: New email. */
__( 'There is a pending change of your email to %s.' ),
'<code>' . esc_html( $new_email['newemail'] ) . '</code>'
);
printf(
$pending_change_message .= sprintf(
' <a href="%1$s">%2$s</a>',
esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
__( 'Cancel' )
);
wp_admin_notice(
$pending_change_message,
array(
'additional_classes' => array( 'updated', 'inline' ),
)
);
endif;
?>
</p>
</div>
<?php endif; ?>
</td>
</tr>

View File

@ -396,7 +396,14 @@ endif;
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg ) {
echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
wp_admin_notice(
$msg,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
}
?>

View File

@ -610,11 +610,18 @@ switch ( $wp_list_table->current_action() ) {
/* translators: %s: Number of users. */
$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
}
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
$message = sprintf( $message, number_format_i18n( $delete_count ) );
$messages[] = wp_get_admin_notice(
$message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
break;
case 'add':
$message = __( 'New user created.' );
$user_id = isset( $_GET['id'] ) ? $_GET['id'] : false;
if ( $user_id && current_user_can( 'edit_user', $user_id ) ) {
$message .= sprintf(
@ -630,7 +637,14 @@ switch ( $wp_list_table->current_action() ) {
);
}
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . $message . '</p></div>';
$messages[] = wp_get_admin_notice(
$message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
break;
case 'resetpassword':
$reset_count = isset( $_GET['reset_count'] ) ? (int) $_GET['reset_count'] : 0;
@ -640,25 +654,89 @@ switch ( $wp_list_table->current_action() ) {
/* translators: %s: Number of users. */
$message = _n( 'Password reset links sent to %s user.', 'Password reset links sent to %s users.', $reset_count );
}
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $reset_count ) ) . '</p></div>';
$message = sprintf( $message, number_format_i18n( $reset_count ) );
$messages[] = wp_get_admin_notice(
$message,
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
break;
case 'promote':
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
$messages[] = wp_get_admin_notice(
__( 'Changed roles.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
break;
case 'err_admin_role':
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'The current user&#8217;s role must have user editing capabilities.' ) . '</p></div>';
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Other user roles have been changed.' ) . '</p></div>';
$messages[] = wp_get_admin_notice(
__( 'The current user&#8217;s role must have user editing capabilities.' ),
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'dismissible' => true,
)
);
$messages[] = wp_get_admin_notice(
__( 'Other user roles have been changed.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
break;
case 'err_admin_del':
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'You cannot delete the current user.' ) . '</p></div>';
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Other users have been deleted.' ) . '</p></div>';
$messages[] = wp_get_admin_notice(
__( 'You cannot delete the current user.' ),
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'dismissible' => true,
)
);
$messages[] = wp_get_admin_notice(
__( 'Other users have been deleted.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
break;
case 'remove':
$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __( 'User removed from this site.' ) . '</p></div>';
$messages[] = wp_get_admin_notice(
__( 'User removed from this site.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated', 'fade' ),
'dismissible' => true,
)
);
break;
case 'err_admin_remove':
$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'You cannot remove the current user.' ) . '</p></div>';
$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __( 'Other users have been removed.' ) . '</p></div>';
$messages[] = wp_get_admin_notice(
__( 'You cannot remove the current user.' ),
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'dismissible' => true,
)
);
$messages[] = wp_get_admin_notice(
__( 'Other users have been removed.' ),
array(
'id' => 'message',
'additional_classes' => array( 'updated', 'fade' ),
'dismissible' => true,
)
);
break;
}
endif;

View File

@ -403,14 +403,28 @@ $nonce = wp_create_nonce( 'widgets-access' );
<hr class="wp-header-end">
<?php if ( isset( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { ?>
<div id="message" class="updated notice is-dismissible"><p><?php echo $messages[ $_GET['message'] ]; ?></p></div>
<?php } ?>
<?php if ( isset( $_GET['error'] ) && isset( $errors[ $_GET['error'] ] ) ) { ?>
<div id="message" class="error"><p><?php echo $errors[ $_GET['error'] ]; ?></p></div>
<?php } ?>
<?php
if ( isset( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
wp_admin_notice(
$messages[ $_GET['message'] ],
array(
'id' => 'message',
'additional_classes' => array( 'updated' ),
'dismissible' => true,
)
);
}
if ( isset( $_GET['error'] ) && isset( $errors[ $_GET['error'] ] ) ) {
wp_admin_notice(
$errors[ $_GET['error'] ],
array(
'id' => 'message',
'additional_classes' => array( 'error' ),
'dismissible' => true,
)
);
}
/**
* Fires before the Widgets administration page content loads.
*

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-alpha-56572';
$wp_version = '6.4-alpha-56573';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.