Changing default Buddypress avatar affects all site avatars (because gravatar)

Ok so I think I found a solution and wanted to post in case this is an issue for anyone else.

I decided to forgo trying to create a custom default avatar through buddypress specifically, which means I’m no longer talking about using the bp-custom.php file.

Instead I’ve opted to create a custom gravatar option within the wordpress backend, using my child theme’s function file.

I’ve tried a couple different code versions, but this is what I ended up sticking with:

add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar="http://example.com/wp-content/uploads/2017/01/wpb-default- 
gravatar.png";
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;
} 

Add the above code to your theme function file and replace the dummy image address with your desired default gravatar/avatar image for all wordpress users.

Then go to settings > discussion in the wordpress admin area.

You should see your custom avatar image at the bottom of the avatar image list.

Choose that as the default, and save.

Now that image will be the default across all site users, including buddypress, but still allows users to upload their own either through buddypress or through the wordpress admin area via gravatar.