2003-10-27 02:09:25 -05:00
< ? php
2008-08-16 03:27:34 -04:00
/**
2011-04-28 11:24:49 -04:00
* Edit Comments Administration Screen .
2008-08-16 03:27:34 -04:00
*
* @ package WordPress
* @ subpackage Administration
*/
/** WordPress Administration Bootstrap */
2020-02-06 01:33:11 -05:00
require_once __DIR__ . '/admin.php' ;
2015-09-02 14:04:21 -04:00
if ( ! current_user_can ( 'edit_posts' ) ) {
wp_die (
2018-02-18 21:13:32 -05:00
'<h1>' . __ ( 'You need a higher level of permission.' ) . '</h1>' .
2016-06-29 11:16:29 -04:00
'<p>' . __ ( 'Sorry, you are not allowed to edit comments.' ) . '</p>' ,
2015-09-02 14:04:21 -04:00
403
);
}
2010-11-17 13:47:34 -05:00
2017-11-30 18:11:00 -05:00
$wp_list_table = _get_list_table ( 'WP_Comments_List_Table' );
$pagenum = $wp_list_table -> get_pagenum ();
2009-08-01 17:58:59 -04:00
2010-09-21 20:10:39 -04:00
$doaction = $wp_list_table -> current_action ();
if ( $doaction ) {
2010-08-11 17:54:51 -04:00
check_admin_referer ( 'bulk-comments' );
2009-09-14 10:03:32 -04:00
2020-05-12 14:32:08 -04:00
if ( 'delete_all' === $doaction && ! empty ( $_REQUEST [ 'pagegen_timestamp' ] ) ) {
2022-05-29 11:35:11 -04:00
/**
* @ global wpdb $wpdb WordPress database abstraction object .
*/
global $wpdb ;
2013-03-01 12:14:09 -05:00
$comment_status = wp_unslash ( $_REQUEST [ 'comment_status' ] );
2017-11-30 18:11:00 -05:00
$delete_time = wp_unslash ( $_REQUEST [ 'pagegen_timestamp' ] );
2023-04-06 12:44:22 -04:00
$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
)
);
2017-11-30 18:11:00 -05:00
$doaction = 'delete' ;
2010-09-21 20:10:39 -04:00
} elseif ( isset ( $_REQUEST [ 'delete_comments' ] ) ) {
2009-07-20 23:11:12 -04:00
$comment_ids = $_REQUEST [ 'delete_comments' ];
2021-01-07 11:23:07 -05:00
$doaction = $_REQUEST [ 'action' ];
2010-09-21 20:10:39 -04:00
} elseif ( isset ( $_REQUEST [ 'ids' ] ) ) {
2010-08-11 17:54:51 -04:00
$comment_ids = array_map ( 'absint' , explode ( ',' , $_REQUEST [ 'ids' ] ) );
2010-11-24 21:05:52 -05:00
} elseif ( wp_get_referer () ) {
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( wp_get_referer () );
2010-09-26 06:02:23 -04:00
exit ;
2009-11-27 05:34:09 -05:00
}
2009-09-14 10:03:32 -04:00
2019-07-01 08:52:01 -04:00
$approved = 0 ;
$unapproved = 0 ;
$spammed = 0 ;
$unspammed = 0 ;
$trashed = 0 ;
$untrashed = 0 ;
$deleted = 0 ;
2009-09-14 10:03:32 -04:00
2023-04-06 12:44:22 -04:00
$redirect_to = remove_query_arg (
array (
'trashed' ,
'untrashed' ,
'deleted' ,
'spammed' ,
'unspammed' ,
'approved' ,
'unapproved' ,
'ids' ,
),
wp_get_referer ()
);
2011-01-16 16:34:38 -05:00
$redirect_to = add_query_arg ( 'paged' , $pagenum , $redirect_to );
2010-12-10 03:49:16 -05:00
2015-09-14 18:24:26 -04:00
wp_defer_comment_counting ( true );
2020-01-28 19:45:18 -05:00
foreach ( $comment_ids as $comment_id ) { // Check the permissions on each.
2017-11-30 18:11:00 -05:00
if ( ! current_user_can ( 'edit_comment' , $comment_id ) ) {
2008-02-23 21:33:30 -05:00
continue ;
2017-11-30 18:11:00 -05:00
}
2008-09-29 05:26:21 -04:00
2010-08-11 17:54:51 -04:00
switch ( $doaction ) {
2017-11-30 18:11:00 -05:00
case 'approve' :
2010-08-11 17:54:51 -04:00
wp_set_comment_status ( $comment_id , 'approve' );
2023-09-09 05:28:26 -04:00
++ $approved ;
2009-07-20 23:11:12 -04:00
break ;
2017-11-30 18:11:00 -05:00
case 'unapprove' :
2010-08-11 17:54:51 -04:00
wp_set_comment_status ( $comment_id , 'hold' );
2023-09-09 05:28:26 -04:00
++ $unapproved ;
2009-07-20 23:11:12 -04:00
break ;
2017-11-30 18:11:00 -05:00
case 'spam' :
2010-08-11 17:54:51 -04:00
wp_spam_comment ( $comment_id );
2023-09-09 05:28:26 -04:00
++ $spammed ;
2008-09-29 05:26:21 -04:00
break ;
2017-11-30 18:11:00 -05:00
case 'unspam' :
2010-08-11 17:54:51 -04:00
wp_unspam_comment ( $comment_id );
2023-09-09 05:28:26 -04:00
++ $unspammed ;
2009-11-27 05:34:09 -05:00
break ;
2017-11-30 18:11:00 -05:00
case 'trash' :
2010-08-11 17:54:51 -04:00
wp_trash_comment ( $comment_id );
2023-09-09 05:28:26 -04:00
++ $trashed ;
2009-07-30 09:39:34 -04:00
break ;
2017-11-30 18:11:00 -05:00
case 'untrash' :
2010-08-11 17:54:51 -04:00
wp_untrash_comment ( $comment_id );
2023-09-09 05:28:26 -04:00
++ $untrashed ;
2009-07-30 09:39:34 -04:00
break ;
2017-11-30 18:11:00 -05:00
case 'delete' :
2010-08-11 17:54:51 -04:00
wp_delete_comment ( $comment_id );
2023-09-09 05:28:26 -04:00
++ $deleted ;
2008-09-29 05:26:21 -04:00
break ;
2006-02-14 15:09:13 -05:00
}
2009-07-20 23:11:12 -04:00
}
2008-09-29 05:26:21 -04:00
2016-09-23 16:33:30 -04:00
if ( ! in_array ( $doaction , array ( 'approve' , 'unapprove' , 'spam' , 'unspam' , 'trash' , 'delete' ), true ) ) {
2016-12-13 23:18:42 -05:00
$screen = get_current_screen () -> id ;
2019-12-03 08:58:05 -05:00
/** This action is documented in wp-admin/edit.php */
2019-07-04 21:45:56 -04:00
$redirect_to = apply_filters ( " handle_bulk_actions- { $screen } " , $redirect_to , $doaction , $comment_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
2016-09-23 16:33:30 -04:00
}
2015-09-14 18:24:26 -04:00
wp_defer_comment_counting ( false );
2017-11-30 18:11:00 -05:00
if ( $approved ) {
2009-11-27 05:34:09 -05:00
$redirect_to = add_query_arg ( 'approved' , $approved , $redirect_to );
2017-11-30 18:11:00 -05:00
}
if ( $unapproved ) {
2009-11-27 05:34:09 -05:00
$redirect_to = add_query_arg ( 'unapproved' , $unapproved , $redirect_to );
2017-11-30 18:11:00 -05:00
}
if ( $spammed ) {
2009-11-27 05:34:09 -05:00
$redirect_to = add_query_arg ( 'spammed' , $spammed , $redirect_to );
2017-11-30 18:11:00 -05:00
}
if ( $unspammed ) {
2009-11-27 05:34:09 -05:00
$redirect_to = add_query_arg ( 'unspammed' , $unspammed , $redirect_to );
2017-11-30 18:11:00 -05:00
}
if ( $trashed ) {
2009-11-27 05:34:09 -05:00
$redirect_to = add_query_arg ( 'trashed' , $trashed , $redirect_to );
2017-11-30 18:11:00 -05:00
}
if ( $untrashed ) {
2009-11-27 05:34:09 -05:00
$redirect_to = add_query_arg ( 'untrashed' , $untrashed , $redirect_to );
2017-11-30 18:11:00 -05:00
}
if ( $deleted ) {
2009-11-27 05:34:09 -05:00
$redirect_to = add_query_arg ( 'deleted' , $deleted , $redirect_to );
2017-11-30 18:11:00 -05:00
}
if ( $trashed || $spammed ) {
2020-10-18 13:27:06 -04:00
$redirect_to = add_query_arg ( 'ids' , implode ( ',' , $comment_ids ), $redirect_to );
2017-11-30 18:11:00 -05:00
}
2009-11-27 05:34:09 -05:00
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( $redirect_to );
2009-12-19 06:30:54 -05:00
exit ;
2011-01-14 21:03:46 -05:00
} elseif ( ! empty ( $_GET [ '_wp_http_referer' ] ) ) {
2017-11-26 18:57:55 -05:00
wp_redirect ( remove_query_arg ( array ( '_wp_http_referer' , '_wpnonce' ), wp_unslash ( $_SERVER [ 'REQUEST_URI' ] ) ) );
exit ;
2008-02-24 15:28:36 -05:00
}
2004-02-17 05:50:33 -05:00
2010-08-22 07:22:46 -04:00
$wp_list_table -> prepare_items ();
2010-08-11 17:54:51 -04:00
2017-11-30 18:11:00 -05:00
wp_enqueue_script ( 'admin-comments' );
2010-08-11 17:54:51 -04:00
enqueue_comment_hotkeys_js ();
2022-05-29 11:35:11 -04:00
/**
* @ global int $post_id
*/
global $post_id ;
2015-08-31 13:58:22 -04:00
if ( $post_id ) {
2017-11-30 18:11:00 -05:00
$comments_count = wp_count_comments ( $post_id );
2015-08-31 13:58:22 -04:00
$draft_or_post_title = wp_html_excerpt ( _draft_or_post_title ( $post_id ), 50 , '…' );
2021-07-22 09:53:00 -04:00
2015-08-31 13:58:22 -04:00
if ( $comments_count -> moderated > 0 ) {
2021-07-22 09:53:00 -04:00
// Used in the HTML title tag.
2017-11-30 18:11:00 -05:00
$title = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: 1: Comments count, 2: Post title. */
2017-11-30 18:11:00 -05:00
__ ( 'Comments (%1$s) on “%2$s”' ),
2015-08-31 13:58:22 -04:00
number_format_i18n ( $comments_count -> moderated ),
$draft_or_post_title
);
} else {
2021-07-22 09:53:00 -04:00
// Used in the HTML title tag.
2017-11-30 18:11:00 -05:00
$title = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: Post title. */
2017-11-30 18:11:00 -05:00
__ ( 'Comments on “%s”' ),
2015-11-05 19:23:25 -05:00
$draft_or_post_title
);
2015-08-31 13:58:22 -04:00
}
} else {
$comments_count = wp_count_comments ();
2021-07-22 09:53:00 -04:00
2015-08-31 13:58:22 -04:00
if ( $comments_count -> moderated > 0 ) {
2021-07-22 09:53:00 -04:00
// Used in the HTML title tag.
2017-11-30 18:11:00 -05:00
$title = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: Comments count. */
2017-11-30 18:11:00 -05:00
__ ( 'Comments (%s)' ),
2015-08-31 13:58:22 -04:00
number_format_i18n ( $comments_count -> moderated )
);
} else {
2021-07-22 09:53:00 -04:00
// Used in the HTML title tag.
2015-08-31 13:58:22 -04:00
$title = __ ( 'Comments' );
}
}
2008-11-19 23:51:47 -05:00
2015-03-10 11:32:27 -04:00
add_screen_option ( 'per_page' );
2011-10-02 02:59:36 -04:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
2020-07-06 17:52:21 -04:00
'<p>' . __ ( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the bulk actions.' ) . '</p>' ,
2017-11-30 18:11:00 -05:00
)
);
get_current_screen () -> add_help_tab (
array (
'id' => 'moderating-comments' ,
'title' => __ ( 'Moderating Comments' ),
'content' =>
2019-07-05 01:21:56 -04:00
'<p>' . __ ( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' .
2023-06-19 14:27:27 -04:00
'<p>' . __ ( 'In the <strong>Author</strong> column, in addition to the author’s name, email address, and site URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' .
2019-07-05 01:21:56 -04:00
'<p>' . __ ( 'In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' .
2020-07-06 17:52:21 -04:00
'<p>' . __ ( 'In the <strong>In response to</strong> column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved comments that post has received. If there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.' ) . '</p>' .
'<p>' . __ ( 'In the <strong>Submitted on</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.' ) . '</p>' .
2019-07-05 01:21:56 -04:00
'<p>' . __ ( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>' ,
2017-11-30 18:11:00 -05:00
)
);
2011-11-01 23:12:37 -04:00
2011-11-02 16:14:10 -04:00
get_current_screen () -> set_help_sidebar (
2010-05-27 19:38:20 -04:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2023-02-23 05:38:21 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/comments-screen/">Documentation on Comments</a>' ) . '</p>' .
2023-02-23 06:06:19 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/understand-comment-spam/">Documentation on Comment Spam</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/keyboard-shortcuts-classic-editor/#keyboard-shortcuts-for-comments">Documentation on Keyboard Shortcuts</a>' ) . '</p>' .
2023-02-23 05:38:21 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
2010-05-25 17:59:42 -04:00
);
2011-11-01 23:12:37 -04:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> set_screen_reader_content (
array (
'heading_views' => __ ( 'Filter comments list' ),
'heading_pagination' => __ ( 'Comments list navigation' ),
'heading_list' => __ ( 'Comments list' ),
)
);
2015-10-06 21:28:25 -04:00
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2010-08-11 17:54:51 -04:00
?>
2008-09-08 17:49:26 -04:00
2008-11-05 14:48:43 -05:00
< div class = " wrap " >
2017-11-30 18:11:00 -05:00
< h1 class = " wp-heading-inline " >
< ? php
2015-11-05 19:23:25 -05:00
if ( $post_id ) {
2017-11-30 18:11:00 -05:00
printf (
2019-09-02 20:41:05 -04:00
/* translators: %s: Link to post. */
2017-11-30 18:11:00 -05:00
__ ( 'Comments on “%s”' ),
sprintf (
'<a href="%1$s">%2$s</a>' ,
2013-05-08 20:22:02 -04:00
get_edit_post_link ( $post_id ),
wp_html_excerpt ( _draft_or_post_title ( $post_id ), 50 , '…' )
2010-11-29 16:23:20 -05:00
)
);
2015-11-05 19:23:25 -05:00
} else {
2015-05-03 12:18:28 -04:00
_e ( 'Comments' );
2015-11-05 19:23:25 -05:00
}
2017-11-30 18:11:00 -05:00
?>
</ h1 >
2010-11-29 16:23:20 -05:00
2016-12-09 13:59:40 -05:00
< ? php
2021-05-25 08:26:58 -04:00
if ( $post_id ) {
$post_type_object = get_post_type_object ( get_post_type ( $post_id ) );
if ( $post_type_object ) {
printf (
'<a href="%1$s" class="comments-view-item-link">%2$s</a>' ,
get_permalink ( $post_id ),
$post_type_object -> labels -> view_item
);
}
}
2017-11-30 18:11:00 -05:00
if ( isset ( $_REQUEST [ 's' ] ) && strlen ( $_REQUEST [ 's' ] ) ) {
2015-11-05 19:23:25 -05:00
echo '<span class="subtitle">' ;
2017-11-30 18:11:00 -05:00
printf (
2019-09-02 20:41:05 -04:00
/* translators: %s: Search query. */
2020-10-23 12:01:15 -04:00
__ ( 'Search results for: %s' ),
2021-11-02 11:57:59 -04:00
'<strong>' . esc_html ( wp_unslash ( $_REQUEST [ 's' ] ) ) . '</strong>'
2015-11-05 19:23:25 -05:00
);
echo '</span>' ;
}
2016-12-09 13:59:40 -05:00
?>
< hr class = " wp-header-end " >
2008-11-05 14:48:43 -05:00
2008-09-28 00:11:27 -04:00
< ? php
2010-08-11 17:54:51 -04:00
if ( isset ( $_REQUEST [ 'error' ] ) ) {
2017-11-30 18:11:00 -05:00
$error = ( int ) $_REQUEST [ 'error' ];
2010-02-20 06:18:25 -05:00
$error_msg = '' ;
switch ( $error ) {
2017-11-30 18:11:00 -05:00
case 1 :
2015-07-26 19:36:24 -04:00
$error_msg = __ ( 'Invalid comment ID.' );
2010-02-20 06:18:25 -05:00
break ;
2017-11-30 18:11:00 -05:00
case 2 :
2016-06-29 11:16:29 -04:00
$error_msg = __ ( 'Sorry, you are not allowed to edit comments on this post.' );
2010-02-20 06:18:25 -05:00
break ;
}
2017-11-30 18:11:00 -05:00
if ( $error_msg ) {
Administration: Use `wp_admin_notice()` more in `wp-admin/`.
Add additional usage of `wp_admin_notice()` in `wp-admin/` on `.error` and miscellaneous usages previously overlooked.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56600
git-svn-id: http://core.svn.wordpress.org/trunk@56112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 11:33:17 -04:00
wp_admin_notice (
$error_msg ,
array (
'id' => 'moderated' ,
'additional_classes' => array ( 'error' ),
)
);
2017-11-30 18:11:00 -05:00
}
2010-02-20 06:18:25 -05:00
}
2023-04-06 12:44:22 -04:00
if ( isset ( $_REQUEST [ 'approved' ] )
|| isset ( $_REQUEST [ 'deleted' ] )
|| isset ( $_REQUEST [ 'trashed' ] )
|| isset ( $_REQUEST [ 'untrashed' ] )
|| isset ( $_REQUEST [ 'spammed' ] )
|| isset ( $_REQUEST [ 'unspammed' ] )
|| isset ( $_REQUEST [ 'same' ] )
) {
2017-11-30 18:11:00 -05:00
$approved = isset ( $_REQUEST [ 'approved' ] ) ? ( int ) $_REQUEST [ 'approved' ] : 0 ;
$deleted = isset ( $_REQUEST [ 'deleted' ] ) ? ( int ) $_REQUEST [ 'deleted' ] : 0 ;
$trashed = isset ( $_REQUEST [ 'trashed' ] ) ? ( int ) $_REQUEST [ 'trashed' ] : 0 ;
2010-08-11 17:54:51 -04:00
$untrashed = isset ( $_REQUEST [ 'untrashed' ] ) ? ( int ) $_REQUEST [ 'untrashed' ] : 0 ;
2017-11-30 18:11:00 -05:00
$spammed = isset ( $_REQUEST [ 'spammed' ] ) ? ( int ) $_REQUEST [ 'spammed' ] : 0 ;
2010-08-11 17:54:51 -04:00
$unspammed = isset ( $_REQUEST [ 'unspammed' ] ) ? ( int ) $_REQUEST [ 'unspammed' ] : 0 ;
2017-11-30 18:11:00 -05:00
$same = isset ( $_REQUEST [ 'same' ] ) ? ( int ) $_REQUEST [ 'same' ] : 0 ;
2009-07-30 09:39:34 -04:00
2010-02-20 06:48:38 -05:00
if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
2015-11-05 19:23:25 -05:00
if ( $approved > 0 ) {
2023-04-06 12:44:22 -04:00
$messages [] = sprintf (
/* translators: %s: Number of comments. */
_n ( '%s comment approved.' , '%s comments approved.' , $approved ),
$approved
);
2015-11-05 19:23:25 -05:00
}
2008-02-23 21:33:30 -05:00
2009-11-27 05:34:09 -05:00
if ( $spammed > 0 ) {
2017-11-30 18:11:00 -05:00
$ids = isset ( $_REQUEST [ 'ids' ] ) ? $_REQUEST [ 'ids' ] : 0 ;
2023-04-06 12:44:22 -04:00
$messages [] = sprintf (
/* translators: %s: Number of comments. */
_n ( '%s comment marked as spam.' , '%s comments marked as spam.' , $spammed ),
$spammed
) . sprintf (
' <a href="%1$s">%2$s</a><br />' ,
esc_url ( wp_nonce_url ( " edit-comments.php?doaction=undo&action=unspam&ids= $ids " , 'bulk-comments' ) ),
__ ( 'Undo' )
);
2009-07-20 23:11:12 -04:00
}
2010-02-20 06:18:25 -05:00
2015-11-05 19:23:25 -05:00
if ( $unspammed > 0 ) {
2023-04-06 12:44:22 -04:00
$messages [] = sprintf (
/* translators: %s: Number of comments. */
_n ( '%s comment restored from the spam.' , '%s comments restored from the spam.' , $unspammed ),
$unspammed
);
2015-11-05 19:23:25 -05:00
}
2010-02-20 06:18:25 -05:00
2009-07-30 09:39:34 -04:00
if ( $trashed > 0 ) {
2017-11-30 18:11:00 -05:00
$ids = isset ( $_REQUEST [ 'ids' ] ) ? $_REQUEST [ 'ids' ] : 0 ;
2023-04-06 12:44:22 -04:00
$messages [] = sprintf (
/* translators: %s: Number of comments. */
_n ( '%s comment moved to the Trash.' , '%s comments moved to the Trash.' , $trashed ),
$trashed
) . sprintf (
' <a href="%1$s">%2$s</a><br />' ,
esc_url ( wp_nonce_url ( " edit-comments.php?doaction=undo&action=untrash&ids= $ids " , 'bulk-comments' ) ),
__ ( 'Undo' )
);
2008-02-23 21:33:30 -05:00
}
2015-11-05 19:23:25 -05:00
if ( $untrashed > 0 ) {
2023-04-06 12:44:22 -04:00
$messages [] = sprintf (
/* translators: %s: Number of comments. */
_n ( '%s comment restored from the Trash.' , '%s comments restored from the Trash.' , $untrashed ),
$untrashed
);
2015-11-05 19:23:25 -05:00
}
2010-02-20 06:18:25 -05:00
2015-11-05 19:23:25 -05:00
if ( $deleted > 0 ) {
2023-04-06 12:44:22 -04:00
$messages [] = sprintf (
/* translators: %s: Number of comments. */
_n ( '%s comment permanently deleted.' , '%s comments permanently deleted.' , $deleted ),
$deleted
);
2015-11-05 19:23:25 -05:00
}
2010-02-20 06:18:25 -05:00
2019-07-01 08:52:01 -04:00
if ( $same > 0 ) {
$comment = get_comment ( $same );
if ( $comment ) {
switch ( $comment -> comment_approved ) {
case '1' :
2023-04-06 12:44:22 -04:00
$messages [] = __ ( 'This comment is already approved.' ) . sprintf (
' <a href="%1$s">%2$s</a>' ,
esc_url ( admin_url ( " comment.php?action=editcomment&c= $same " ) ),
__ ( 'Edit comment' )
);
2019-07-01 08:52:01 -04:00
break ;
case 'trash' :
2023-04-06 12:44:22 -04:00
$messages [] = __ ( 'This comment is already in the Trash.' ) . sprintf (
' <a href="%1$s">%2$s</a>' ,
esc_url ( admin_url ( 'edit-comments.php?comment_status=trash' ) ),
__ ( 'View Trash' )
);
2019-07-01 08:52:01 -04:00
break ;
case 'spam' :
2023-04-06 12:44:22 -04:00
$messages [] = __ ( 'This comment is already marked as spam.' ) . sprintf (
' <a href="%1$s">%2$s</a>' ,
esc_url ( admin_url ( " comment.php?action=editcomment&c= $same " ) ),
__ ( 'Edit comment' )
);
2019-07-01 08:52:01 -04:00
break ;
}
2010-02-20 06:48:38 -05:00
}
}
2023-09-14 01:50:20 -04:00
wp_admin_notice (
2023-09-13 22:15:17 -04:00
implode ( " <br /> \n " , $messages ),
array (
'id' => 'moderated' ,
'additional_classes' => array ( 'updated' ),
'dismissible' => true ,
)
2023-04-06 12:44:22 -04:00
);
2008-02-23 21:33:30 -05:00
}
}
?>
2008-09-29 05:26:21 -04:00
2010-09-05 17:26:27 -04:00
< ? php $wp_list_table -> views (); ?>
2008-02-23 21:33:30 -05:00
2015-01-15 23:16:24 -05:00
< form id = " comments-form " method = " get " >
2010-12-10 15:22:34 -05:00
2010-12-16 15:45:10 -05:00
< ? php $wp_list_table -> search_box ( __ ( 'Search Comments' ), 'comment' ); ?>
2010-12-10 15:22:34 -05:00
2008-12-05 22:59:03 -05:00
< ? php if ( $post_id ) : ?>
2020-10-08 17:15:13 -04:00
< input type = " hidden " name = " p " value = " <?php echo esc_attr( (int) $post_id ); ?> " />
2008-12-05 22:59:03 -05:00
< ? php endif ; ?>
2017-11-30 18:11:00 -05:00
< input type = " hidden " name = " comment_status " value = " <?php echo esc_attr( $comment_status ); ?> " />
< input type = " hidden " name = " pagegen_timestamp " value = " <?php echo esc_attr( current_time( 'mysql', 1 ) ); ?> " />
2008-02-28 01:50:25 -05:00
2017-11-30 18:11:00 -05:00
< input type = " hidden " name = " _total " value = " <?php echo esc_attr( $wp_list_table->get_pagination_arg ( 'total_items' ) ); ?> " />
< input type = " hidden " name = " _per_page " value = " <?php echo esc_attr( $wp_list_table->get_pagination_arg ( 'per_page' ) ); ?> " />
< input type = " hidden " name = " _page " value = " <?php echo esc_attr( $wp_list_table->get_pagination_arg ( 'page' ) ); ?> " />
2008-10-30 11:50:21 -04:00
2017-11-30 18:11:00 -05:00
< ? php if ( isset ( $_REQUEST [ 'paged' ] ) ) { ?>
2010-08-11 17:54:51 -04:00
< input type = " hidden " name = " paged " value = " <?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?> " />
< ? php } ?>
2008-09-29 05:26:21 -04:00
2010-10-30 21:17:00 -04:00
< ? php $wp_list_table -> display (); ?>
2008-02-28 01:50:25 -05:00
</ form >
2010-12-24 09:19:41 -05:00
</ div >
2008-02-28 01:50:25 -05:00
2006-03-28 20:51:55 -05:00
< div id = " ajax-response " ></ div >
2003-10-27 02:09:25 -05:00
2008-08-24 02:56:22 -04:00
< ? php
2017-11-30 18:11:00 -05:00
wp_comment_reply ( '-1' , true , 'detail' );
2009-10-08 04:24:59 -04:00
wp_comment_trashnotice ();
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ; ?>