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.

git-svn-id: https://develop.svn.wordpress.org/trunk@56573 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson
2023-09-14 02:13:42 +00:00
parent 795534f909
commit f43aaaf741
13 changed files with 429 additions and 181 deletions

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(
/* translators: %s: New email. */
__( 'There is a pending change of your email to %s.' ),
'<code>' . esc_html( $new_email['newemail'] ) . '</code>'
);
printf(
' <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' )
);
?>
</p>
</div>
<?php endif; ?>
<?php
$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>'
);
$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;
?>
</td>
</tr>