WP_Comments_List_Table::single_row( WP_Comment $item )

In this article

Parameters

$itemWP_Commentrequired

Source

public function single_row( $item ) {
	global $post, $comment;

	$comment = $item;

	$the_comment_class = wp_get_comment_status( $comment );

	if ( ! $the_comment_class ) {
		$the_comment_class = '';
	}

	$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";

	unset( $GLOBALS['post'], $GLOBALS['comment'] );
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.