Debug ideas:
You could try to see if this has any effect:
add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );
But you should check out the parameters that go through the bp_core_fetch_avatar
filter to see if they are correct (untested):
add_filter( 'bp_core_fetch_avatar', 'my_bp_core_fetch_avatar', 99, 9 );
function my_bp_core_fetch_avatar( $html, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir )
{
// debug:
$args = array(
'html' => $html,
'params' => join( ', ', $params ),
'item_id' => $item_id,
'avatar_dir' => $avatar_dir,
'css_id' => $css_id,
'html_width' => $html_width,
'html_height' => $html_height,
'avatar_folder_url' => $avatar_folder_url,
'avatar_folder_dir' => $avatar_folder_dir,
);
$debug = date_i18n( 'c' );
foreach( $args as $key => $value )
{
$debug .= sprintf( ' | %s: %s ', $key, $value );
}
error_log( $debug . PHP_EOL , 3, '/path/to/my/debug.log' );
return $html;
}
where you have to modify the path to your writeable debug.log
file.
The file should then contain lines like this one:
2013-11-12T12:01:16+00:00 | html: ??? | params: ??? | item_id: ??? | avatar_dir: ??? | css_id: ??? | html_width: ??? | html_height: ??? | avatar_folder_url: ??? | avatar_folder_dir: ???
I updated the above debug code, to take into account that $params
is an array.
Some general remarks:
It’s interesting to look into the file /bp-core/bp-core-avatars.php
.
The avatar image seems to be overwritten via this filter:
add_filter( 'get_avatar', 'bp_core_fetch_avatar_filter', 10, 5 );
and inside the bp_core_fetch_avatar_filter()
callback you have this line:
// Let BuddyPress handle the fetching of the avatar
$bp_avatar = bp_core_fetch_avatar( array( 'item_id' => $id, 'width' => $size, 'height' => $size, 'alt' => $alt ) );
and it was inside that function, I found the applied bp_core_fetch_avatar
filter.
So I think these functions might be worth debugging further or maybe you could try to correct the avatars via the above bp_core_fetch_avatar
filter?