From 67fc9a10379c680fb6dd4e0634d979481e6317e8 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 19 Feb 2010 20:27:56 +0000 Subject: [PATCH] Add filter to get_avatar() to allow avatars for custom comment types. Props usermrpapa. Fixes #11880 git-svn-id: https://develop.svn.wordpress.org/trunk@13231 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/pluggable.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 0a55f285cf..b39662bd3f 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1582,8 +1582,10 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) { if ( $user ) $email = $user->user_email; } elseif ( is_object($id_or_email) ) { - if ( isset($id_or_email->comment_type) && '' != $id_or_email->comment_type && 'comment' != $id_or_email->comment_type ) - return false; // No avatar for pingbacks or trackbacks + // No avatar for pingbacks or trackbacks + $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); + if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) + return false; if ( !empty($id_or_email->user_id) ) { $id = (int) $id_or_email->user_id;