Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#25814 closed enhancement (fixed)

Not enough params for get_comment_class in WP_Comments_List_Table->display()

Reported by: drozdz's profile drozdz Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.8 Priority: normal
Severity: normal Version: 3.3
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

On line 314 you can find:

function single_row( $a_comment ) {
	global $post, $comment;

	$comment = $a_comment;
	$the_comment_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) );

	$post = get_post( $comment->comment_post_ID );

	$this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );

	echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";
	$this->single_row_columns( $comment );
	echo "</tr>\n";
}

It would be much easier to work with it, if get_comment_class would get all params (including comment_ID and post_ID).

Attachments (1)

class-wp-comments-list-table - diff.php (541 bytes) - added by drozdz 11 years ago.
class-wp-comments-list-table - patch

Download all attachments as: .zip

Change History (3)

@drozdz
11 years ago

class-wp-comments-list-table - patch

#1 @SergeyBiryukov
11 years ago

  • Component changed from General to Administration
  • Milestone changed from Awaiting Review to 3.8
  • Version changed from 3.7.1 to 3.3

Related: [18594] (for #18447).

This would also fix the inconsistent (and potentially incorrect) addition of bypostauthor class in the admin. Currently it depends on the $post global, which is set after get_comment_class() is called:
tags/3.7.1/src/wp-admin/includes/class-wp-comments-list-table.php#L310
tags/3.7.1/src/wp-includes/comment-template.php#L348

Last edited 11 years ago by SergeyBiryukov (previous) (diff)

#2 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 26001:

Pass comment ID and comment post ID to get_comment_class() in WP_Comments_List_Table::single_row().

props drozdz.
fixes #25814.

Note: See TracTickets for help on using tickets.