Make WordPress Core

Changeset 33828


Ignore:
Timestamp:
08/31/2015 08:58:12 PM (10 years ago)
Author:
wonderboymusic
Message:

Fix warnings after [33826]. Only only one function call needs a global $comment, we shall hamburger it.

See #11566.

File:
1 edited

Legend:

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

    r33826 r33828  
    4343        $post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
    4444
    45         if ( get_option('show_avatars') )
    46             add_filter( 'comment_author', 'floated_admin_avatar' );
     45        if ( get_option( 'show_avatars' ) ) {
     46            add_filter( 'comment_author', array( $this, 'floated_admin_avatar' ), 10, 2 );
     47        }
    4748
    4849        parent::__construct( array(
     
    5253            'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
    5354        ) );
     55    }
     56
     57    public function floated_admin_avatar( $name, $comment_ID ) {
     58        $comment = get_comment( $comment_ID );
     59        $avatar = get_avatar( $comment, 32, 'mystery' );
     60        return "$avatar $name";
    5461    }
    5562
     
    592599        printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
    593600            /* translators: comment date format. See http://php.net/date */
    594             get_comment_date( __( 'Y/m/d' ) ),
    595             get_comment_date( get_option( 'time_format' ) )
     601            get_comment_date( __( 'Y/m/d' ), $comment->comment_ID ),
     602            get_comment_date( get_option( 'time_format' ), $comment->comment_ID )
    596603        );
    597604
     
    604611
    605612        echo '</div>';
    606         comment_text();
     613        comment_text( $comment->comment_ID );
    607614        if ( $this->user_can ) { ?>
    608615        <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
     
    629636        global $comment_status;
    630637
    631         $author_url = get_comment_author_url();
     638        $author_url = get_comment_author_url( $comment->comment_ID );
    632639        if ( 'http://' == $author_url ) {
    633640            $author_url = '';
     
    640647
    641648
    642         echo "<strong>"; comment_author(); echo '</strong><br />';
     649        echo "<strong>"; comment_author( $comment->comment_ID ); echo '</strong><br />';
    643650        if ( !empty( $author_url ) ) {
    644651            echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
     
    647654        if ( $this->user_can ) {
    648655            if ( !empty( $comment->comment_author_email ) ) {
     656                $GLOBALS['comment'] = $comment;
    649657                comment_author_email_link();
    650658                echo '<br />';
     659                unset( $GLOBALS['comment'] );
    651660            }
    652661
    653             $author_ip = get_comment_author_IP();
     662            $author_ip = get_comment_author_IP( $comment->comment_ID );
    654663            if ( $author_ip ) {
    655664                $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail' ), 'edit-comments.php' );
     
    666675     * @return string
    667676     */
    668     public function column_date() {
    669         return get_comment_date( __( 'Y/m/d \a\t g:i a' ) );
     677    public function column_date( $comment ) {
     678        return get_comment_date( __( 'Y/m/d \a\t g:i a' ), $comment->comment_ID );
    670679    }
    671680
Note: See TracChangeset for help on using the changeset viewer.