BuddyPress Avatars broken, I've linked them to Groups Avatars, need to fix

Using BuddyPress and MU, the BP avatars, by default are do not load on the blogs and when a user comments on a blog post the image link shows as broken. This apparently is a known bug, but not yet fixed in BP Core.

I found a fix on BP.org that properly displays the BP avatars on the blogs and user's comment are properly illustrated with the user's BP avatar.

I don't remember the thread where I found it, there was a lot of searching involved. But here is the fix (the problem it creates, I'll talk about below).

In the plugins directory, you need to create (or add to) a file called bp-custom.php. This code is the avatar fix:


function nfm_bp_avtar_upload_path_correct($path){
	if ( bp_core_is_multisite() ){
		$path = ABSPATH . get_blog_option( BP_ROOT_BLOG, '/wp-content/uploads/avatars/' );
	return $path;
add_filter('bp_core_avatar_upload_path', 'nfm_bp_avtar_upload_path_correct', 1);

function nfm_bp_avatar_upload_url_correct($url){
	if ( bp_core_is_multisite() ){
		$url = get_blog_option( BP_ROOT_BLOG, 'siteurl' ) . "/files";
	return $url;
add_filter('bp_core_avatar_url', 'nfm_bp_avatar_upload_url_correct', 1);

// Custom filters to clean up issues in WP 3.0 with avatar paths.
// Written by @theandystratton
function sizeable_bp_core_avatar_folder_dir( $path ) {
    $items = explode('/', $path);
    $path = ABSPATH . 'wp-content/uploads/avatars/' . end($items);
    return $path;
add_filter('bp_core_avatar_folder_dir', 'sizeable_bp_core_avatar_folder_dir');
function sizeable_bp_core_avatar_folder_url( $url ) {
    $items = explode('/', $url);
    $url = 'http://' . $items[2] . '/wp-content/uploads/avatars/' . end($items);
    return $url;
add_filter('bp_core_avatar_folder_url', 'sizeable_bp_core_avatar_folder_url');


The code fixes the problem but also ends up linking the Groups Avatars with the users who have the same ID number - it was described as a "band-aid, not a proper fix"

So, if the user ID is the same number as the group ID, then it pulls the users avatar and uses it as the group avatar. Everytime a new group is created, it pulls the avatar from the user with the same ID. The only option then, is to delete the user avatar to resort to the identicon (its going to be a bigger problem as the site grows.)

The path called for the group avatar is the one leading to the user's avatar (sitename.com/wp-content/uploads/avatars/). I need to find a way to have it call the group avatars from the group avatar folder, and also upload to that folder. With the above fix in place, an upload for the group avatar simply goes to the user's avatar. The path to the group avatars directory is - sitename.com/wp-content/uploads/group-avatars/

I'm not a coder or programmer so I don't understand how to do this, if someone could take a look and see if there is something that can be added or altered in the above code to account for group avatars I would be very appreciative.