Re: How to disable Gravatar completely?
Hi @BuddyPresser,
I would like to add to Javier’s @arques post above. His method does work but it’s missing the initial sign-up screen where gravatar is being pulled. I also rewrote his path a bit. This should do the trick for killing all Gravatar calls. If someone has more time than I it would be great to have this in plugin form. Here is the code:
`
function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {
$default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;
if( $image && strpos( $image, “gravatar.com” ) ){
return ‘‘;
} else {
return $image;
}
}
add_filter(‘bp_core_fetch_avatar’, ‘bp_remove_gravatar’, 1, 9 );
function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {
$default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;
return ““;
}
add_filter(‘get_avatar’, ‘remove_gravatar’, 1, 5);
function bp_remove_signup_gravatar ($image) {
$default = get_stylesheet_directory_uri() .’/_inc/images/bp_default_avatar.jpg’;
if( $image && strpos( $image, “gravatar.com” ) ){
return ‘‘;
} else {
return $image;
}
}
add_filter(‘bp_get_signup_avatar’, ‘bp_remove_signup_gravatar’, 1, 1 );
`
The image that I am referencing doesn’t have to be a JPG. The size is 150×150. You may have to adjust the file name and/or path to your liking.
Thanks @arques for the initial code!