Buddypress Group codex
How to change group avatar thumbnail?
<?php bp_group_avatar_thumb() ?>
// Usage
bp_group_avatar( 'type=thumb&width=50&height=50' );
// Original codes
function bp_group_avatar( $args = '' ) {
echo bp_get_group_avatar( $args );
}
function bp_get_group_avatar( $args = '' ) {
global $groups_template;
// Bail if avatars are turned off.
if ( bp_disable_group_avatar_uploads() || ! buddypress()->avatar->show_avatars ) {
return false;
}
// Parse the arguments.
$r = bp_parse_args( $args, array(
'type' => 'full',
'width' => false,
'height' => false,
'class' => 'avatar',
'id' => false,
'alt' => sprintf( __( 'Group logo of %s', 'buddypress' ), $groups_template->group->name )
) );
// Fetch the avatar from the folder.
$avatar = bp_core_fetch_avatar( array(
'item_id' => $groups_template->group->id,
'avatar_dir' => 'group-avatars',
'object' => 'group',
'type' => $r['type'],
'alt' => $r['alt'],
'css_id' => $r['id'],
'class' => $r['class'],
'width' => $r['width'],
'height' => $r['height'],
) );
// If No avatar found, provide some backwards compatibility.
if ( empty( $avatar ) ) {
$avatar = '<img src="' . esc_url( $groups_template->group->avatar_thumb ) . '" class="avatar" alt="' . esc_attr( $groups_template->group->name ) . '" />';
}
/**
* Filters the group avatar while in the groups loop.
*
* @since 1.0.0
*
* @param string $avatar HTML image element holding the group avatar.
* @param array $r Array of parsed arguments for the group avatar.
*/
return apply_filters( 'bp_get_group_avatar', $avatar, $r );
}
