From cd225e64bdd5f6bcc4ce46111ab62071d8e83cba Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 13 Sep 2008 18:16:42 +0000 Subject: [PATCH] Hook floated_admin_avatar to admin_init. Props DD32. fixes #7738 git-svn-id: https://develop.svn.wordpress.org/trunk@8881 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/comment.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/comment.php b/wp-admin/includes/comment.php index 4b888002b4..ee8300da25 100644 --- a/wp-admin/includes/comment.php +++ b/wp-admin/includes/comment.php @@ -106,6 +106,15 @@ function get_pending_comments_num( $post_id ) { // Add avatars to relevant places in admin, or try to +add_action('admin_init', 'floated_admin_avatar_handler'); +function floated_admin_avatar_handler() { + global $pagenow; + if ( 'edit-comments.php' == $pagenow || 'edit.php' == $pagenow ) { + if ( get_option('show_avatars') ) + add_filter( 'comment_author', 'floated_admin_avatar' ); + } +} + function floated_admin_avatar( $name ) { global $comment; @@ -121,11 +130,6 @@ function floated_admin_avatar( $name ) { return "$avatar $name"; } -if ( is_admin() && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) { - if ( get_option('show_avatars') ) - add_filter( 'comment_author', 'floated_admin_avatar' ); -} - function wp_get_inbox_items() { $r = array(); $r[] = (object) array(