diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index 866678badf..d1960c91b4 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -32,7 +32,14 @@ if ( $doaction ) {
$comment_status = wp_unslash( $_REQUEST['comment_status'] );
$delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] );
- $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) );
+ $comment_ids = $wpdb->get_col(
+ $wpdb->prepare(
+ "SELECT comment_ID FROM $wpdb->comments
+ WHERE comment_approved = %s AND %s > comment_date_gmt",
+ $comment_status,
+ $delete_time
+ )
+ );
$doaction = 'delete';
} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
$comment_ids = $_REQUEST['delete_comments'];
@@ -52,7 +59,19 @@ if ( $doaction ) {
$untrashed = 0;
$deleted = 0;
- $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() );
+ $redirect_to = remove_query_arg(
+ array(
+ 'trashed',
+ 'untrashed',
+ 'deleted',
+ 'spammed',
+ 'unspammed',
+ 'approved',
+ 'unapproved',
+ 'ids',
+ ),
+ wp_get_referer()
+ );
$redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to );
wp_defer_comment_counting( true );
@@ -286,7 +305,14 @@ if ( isset( $_REQUEST['error'] ) ) {
}
}
-if ( isset( $_REQUEST['approved'] ) || isset( $_REQUEST['deleted'] ) || isset( $_REQUEST['trashed'] ) || isset( $_REQUEST['untrashed'] ) || isset( $_REQUEST['spammed'] ) || isset( $_REQUEST['unspammed'] ) || isset( $_REQUEST['same'] ) ) {
+if ( isset( $_REQUEST['approved'] )
+ || isset( $_REQUEST['deleted'] )
+ || isset( $_REQUEST['trashed'] )
+ || isset( $_REQUEST['untrashed'] )
+ || isset( $_REQUEST['spammed'] )
+ || isset( $_REQUEST['unspammed'] )
+ || isset( $_REQUEST['same'] )
+) {
$approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0;
$deleted = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0;
$trashed = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0;
@@ -297,35 +323,63 @@ if ( isset( $_REQUEST['approved'] ) || isset( $_REQUEST['deleted'] ) || isset( $
if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
if ( $approved > 0 ) {
- /* translators: %s: Number of comments. */
- $messages[] = sprintf( _n( '%s comment approved.', '%s comments approved.', $approved ), $approved );
+ $messages[] = sprintf(
+ /* translators: %s: Number of comments. */
+ _n( '%s comment approved.', '%s comments approved.', $approved ),
+ $approved
+ );
}
if ( $spammed > 0 ) {
$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0;
- /* translators: %s: Number of comments. */
- $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' ' . __( 'Undo' ) . '
';
+
+ $messages[] = sprintf(
+ /* translators: %s: Number of comments. */
+ _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ),
+ $spammed
+ ) . sprintf(
+ ' %2$s
',
+ esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", 'bulk-comments' ) ),
+ __( 'Undo' )
+ );
}
if ( $unspammed > 0 ) {
- /* translators: %s: Number of comments. */
- $messages[] = sprintf( _n( '%s comment restored from the spam.', '%s comments restored from the spam.', $unspammed ), $unspammed );
+ $messages[] = sprintf(
+ /* translators: %s: Number of comments. */
+ _n( '%s comment restored from the spam.', '%s comments restored from the spam.', $unspammed ),
+ $unspammed
+ );
}
if ( $trashed > 0 ) {
$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0;
- /* translators: %s: Number of comments. */
- $messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' ' . __( 'Undo' ) . '
';
+
+ $messages[] = sprintf(
+ /* translators: %s: Number of comments. */
+ _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ),
+ $trashed
+ ) . sprintf(
+ ' %2$s
',
+ esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", 'bulk-comments' ) ),
+ __( 'Undo' )
+ );
}
if ( $untrashed > 0 ) {
- /* translators: %s: Number of comments. */
- $messages[] = sprintf( _n( '%s comment restored from the Trash.', '%s comments restored from the Trash.', $untrashed ), $untrashed );
+ $messages[] = sprintf(
+ /* translators: %s: Number of comments. */
+ _n( '%s comment restored from the Trash.', '%s comments restored from the Trash.', $untrashed ),
+ $untrashed
+ );
}
if ( $deleted > 0 ) {
- /* translators: %s: Number of comments. */
- $messages[] = sprintf( _n( '%s comment permanently deleted.', '%s comments permanently deleted.', $deleted ), $deleted );
+ $messages[] = sprintf(
+ /* translators: %s: Number of comments. */
+ _n( '%s comment permanently deleted.', '%s comments permanently deleted.', $deleted ),
+ $deleted
+ );
}
if ( $same > 0 ) {
@@ -333,19 +387,34 @@ if ( isset( $_REQUEST['approved'] ) || isset( $_REQUEST['deleted'] ) || isset( $
if ( $comment ) {
switch ( $comment->comment_approved ) {
case '1':
- $messages[] = __( 'This comment is already approved.' ) . ' ' . __( 'Edit comment' ) . '';
+ $messages[] = __( 'This comment is already approved.' ) . sprintf(
+ ' %2$s',
+ esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ),
+ __( 'Edit comment' )
+ );
break;
case 'trash':
- $messages[] = __( 'This comment is already in the Trash.' ) . ' ' . __( 'View Trash' ) . '';
+ $messages[] = __( 'This comment is already in the Trash.' ) . sprintf(
+ ' %2$s',
+ esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ),
+ __( 'View Trash' )
+ );
break;
case 'spam':
- $messages[] = __( 'This comment is already marked as spam.' ) . ' ' . __( 'Edit comment' ) . '';
+ $messages[] = __( 'This comment is already marked as spam.' ) . sprintf(
+ ' %2$s',
+ esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ),
+ __( 'Edit comment' )
+ );
break;
}
}
}
- echo '
' . implode( "
\n", $messages ) . '
%s
' . implode( ' ', $messages ) . '
%s