Skip to content

Commit 061bfdd

Browse files
committed
Comment List Tables:
* Declare `$extra_items` property * Since `->get_column_info()` overrides its parent's method, it doesn't need to set `_column_headers`, which is an undeclared property that is only used for caching the lookup after the first run in the parent class, which isn't called in the child class. * `$_args` in `WP_List_Table` has to be `protected` for `WP_Post_Comments_List_Table` to legally access it. `$_args` is awkward as is and should probably be only available via a getter. See #30799. git-svn-id: https://develop.svn.wordpress.org/trunk@30984 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 44fe0eb commit 061bfdd

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

src/wp-admin/includes/class-wp-comments-list-table.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class WP_Comments_List_Table extends WP_List_Table {
2121

2222
public $pending_count = array();
2323

24+
public $extra_items;
25+
2426
/**
2527
* Constructor.
2628
*
@@ -379,12 +381,10 @@ public function column_comment( $comment ) {
379381
global $comment_status;
380382
$post = get_post();
381383

382-
$user_can = $this->user_can;
383-
384384
$comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
385385
$the_comment_status = wp_get_comment_status( $comment->comment_ID );
386386

387-
if ( $user_can ) {
387+
if ( $this->user_can ) {
388388
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
389389
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
390390

@@ -420,7 +420,7 @@ public function column_comment( $comment ) {
420420

421421
echo '</div>';
422422
comment_text();
423-
if ( $user_can ) { ?>
423+
if ( $this->user_can ) { ?>
424424
<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
425425
<textarea class="comment" rows="1" cols="1"><?php
426426
/** This filter is documented in wp-admin/includes/comment.php */
@@ -434,7 +434,7 @@ public function column_comment( $comment ) {
434434
<?php
435435
}
436436

437-
if ( $user_can ) {
437+
if ( $this->user_can ) {
438438
// Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash.
439439
$actions = array(
440440
'approve' => '', 'unapprove' => '',
@@ -596,16 +596,14 @@ public function column_default( $comment, $column_name ) {
596596
class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
597597

598598
protected function get_column_info() {
599-
$this->_column_headers = array(
599+
return array(
600600
array(
601-
'author' => __( 'Author' ),
602-
'comment' => _x( 'Comment', 'column name' ),
601+
'author' => __( 'Author' ),
602+
'comment' => _x( 'Comment', 'column name' ),
603603
),
604604
array(),
605605
array(),
606606
);
607-
608-
return $this->_column_headers;
609607
}
610608

611609
protected function get_table_classes() {

src/wp-admin/includes/class-wp-list-table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class WP_List_Table {
2424
*
2525
* @since 3.1.0
2626
* @var array
27-
* @access private
27+
* @access protected
2828
*/
29-
private $_args;
29+
protected $_args;
3030

3131
/**
3232
* Various information needed for displaying the pagination

0 commit comments

Comments
 (0)