Plugin Updates
This commit is contained in:
@@ -437,7 +437,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
* @since 5.6.0 The `$which` parameter was added.
|
||||
*
|
||||
* @param string $comment_status The comment status name. Default 'All'.
|
||||
* @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
|
||||
* @param string $which The location of the extra table nav markup: Either 'top' or 'bottom'.
|
||||
*/
|
||||
do_action( 'manage_comments_nav', $comment_status, $which );
|
||||
|
||||
@@ -638,8 +638,23 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
public function single_row( $item ) {
|
||||
global $post, $comment;
|
||||
|
||||
// Restores the more descriptive, specific name for use within this method.
|
||||
$comment = $item;
|
||||
|
||||
if ( $comment->comment_post_ID > 0 ) {
|
||||
$post = get_post( $comment->comment_post_ID );
|
||||
}
|
||||
|
||||
$edit_post_cap = $post ? 'edit_post' : 'edit_posts';
|
||||
|
||||
if ( ! current_user_can( $edit_post_cap, $comment->comment_post_ID )
|
||||
&& ( post_password_required( $comment->comment_post_ID )
|
||||
|| ! current_user_can( 'read_post', $comment->comment_post_ID ) )
|
||||
) {
|
||||
// The user has no access to the post and thus cannot see the comments.
|
||||
return false;
|
||||
}
|
||||
|
||||
$the_comment_class = wp_get_comment_status( $comment );
|
||||
|
||||
if ( ! $the_comment_class ) {
|
||||
@@ -648,25 +663,8 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
|
||||
$the_comment_class = implode( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) );
|
||||
|
||||
if ( $comment->comment_post_ID > 0 ) {
|
||||
$post = get_post( $comment->comment_post_ID );
|
||||
}
|
||||
|
||||
$this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
|
||||
|
||||
$edit_post_cap = $post ? 'edit_post' : 'edit_posts';
|
||||
if (
|
||||
current_user_can( $edit_post_cap, $comment->comment_post_ID ) ||
|
||||
(
|
||||
empty( $post->post_password ) &&
|
||||
current_user_can( 'read_post', $comment->comment_post_ID )
|
||||
)
|
||||
) {
|
||||
// The user has access to the post
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";
|
||||
$this->single_row_columns( $comment );
|
||||
echo "</tr>\n";
|
||||
|
||||
Reference in New Issue
Block a user