Make WordPress Core


Ignore:
Timestamp:
12/20/2014 11:27:00 PM (10 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r29872 r30984  
    2121
    2222    public $pending_count = array();
     23
     24    public $extra_items;
    2325
    2426    /**
     
    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" ) );
     
    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
     
    435435        }
    436436
    437         if ( $user_can ) {
     437        if ( $this->user_can ) {
    438438            // Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash.
    439439            $actions = array(
     
    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
Note: See TracChangeset for help on using the changeset viewer.