Skip to content

Instantly share code, notes, and snippets.

@anandkumar
Created October 8, 2014 17:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anandkumar/c7ec054c9d41fe0df8be to your computer and use it in GitHub Desktop.
Save anandkumar/c7ec054c9d41fe0df8be to your computer and use it in GitHub Desktop.
bbPress: Remove stupid 14px avatar and resize other.
<?php
//* Do NOT include the opening php tag
//* Notice the line 7, 8, 10 and 11
function my_bbp_change_avatar_size($author_avatar, $topic_id, $size) {
$author_avatar = '';
if ($size == 14) {
return $author_avatar;
}
if ($size == 80) {
$size = 110;
}
$topic_id = bbp_get_topic_id( $topic_id );
if ( !empty( $topic_id ) ) {
if ( !bbp_is_topic_anonymous( $topic_id ) ) {
$author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
} else {
$author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );
}
}
return $author_avatar;
}
/* Add priority (default=10) and number of arguments */
add_filter('bbp_get_topic_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
add_filter('bbp_get_reply_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
add_filter('bbp_get_current_user_avatar', 'my_bbp_change_avatar_size', 20, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment