Skip to content

Instantly share code, notes, and snippets.

@toluaddy
Forked from buddycore/functions.php
Created February 3, 2020 17:22
Show Gist options
  • Save toluaddy/b1e4603dc3d7927d07a8689972ba75c5 to your computer and use it in GitHub Desktop.
Save toluaddy/b1e4603dc3d7927d07a8689972ba75c5 to your computer and use it in GitHub Desktop.
BuddyPress: Default Group Avatar
function sc_bp_default_group_avatar($avatar) {
global $bp, $groups_template;
if(strpos($avatar,'group-avatars')) :
return $avatar;
else :
$default = get_bloginfo('template_directory') .'/asset/img/default/group.png';
if($bp->current_action == "") :
return '<img class="avatar" alt="'. $groups_template->group->name.'" src="'.$default.'">';
else :
return '<img class="avatar" alt="'. $groups_template->group->name.'" src="'.$default.'">';
endif;
endif;
}
add_filter('bp_get_group_avatar', 'sc_bp_default_group_avatar');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment