From fef8794b2c5509f0b63523355bee5b4cffc8010c Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 31 Aug 2015 20:58:12 +0000 Subject: [PATCH] Fix warnings after [33826]. Only only one function call needs a global `$comment`, we shall hamburger it. See #11566. git-svn-id: https://develop.svn.wordpress.org/trunk@33828 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-comments-list-table.php | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php index 8662bdaa50..95e6ab30fb 100644 --- a/src/wp-admin/includes/class-wp-comments-list-table.php +++ b/src/wp-admin/includes/class-wp-comments-list-table.php @@ -42,8 +42,9 @@ class WP_Comments_List_Table extends WP_List_Table { $post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0; - if ( get_option('show_avatars') ) - add_filter( 'comment_author', 'floated_admin_avatar' ); + if ( get_option( 'show_avatars' ) ) { + add_filter( 'comment_author', array( $this, 'floated_admin_avatar' ), 10, 2 ); + } parent::__construct( array( 'plural' => 'comments', @@ -53,6 +54,12 @@ class WP_Comments_List_Table extends WP_List_Table { ) ); } + public function floated_admin_avatar( $name, $comment_ID ) { + $comment = get_comment( $comment_ID ); + $avatar = get_avatar( $comment, 32, 'mystery' ); + return "$avatar $name"; + } + /** * @return bool */ @@ -591,8 +598,8 @@ class WP_Comments_List_Table extends WP_List_Table { /* translators: 2: comment date, 3: comment time */ printf( __( 'Submitted on %2$s at %3$s' ), $comment_url, /* translators: comment date format. See http://php.net/date */ - get_comment_date( __( 'Y/m/d' ) ), - get_comment_date( get_option( 'time_format' ) ) + get_comment_date( __( 'Y/m/d' ), $comment->comment_ID ), + get_comment_date( get_option( 'time_format' ), $comment->comment_ID ) ); if ( $comment->comment_parent ) { @@ -603,7 +610,7 @@ class WP_Comments_List_Table extends WP_List_Table { } echo ''; - comment_text(); + comment_text( $comment->comment_ID ); if ( $this->user_can ) { ?>