Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP Avatars do not display on MU blogs and comments

  • Avatar of Prometheus Fire
    Prometheus Fire
    Participant

    @prometheus-fire

    This is an older problem going back all the way to 2007, I’m starting a new thread for it because it still exists and I want to consolidate all my research so far. This is a bug/issue that definitely needs a permanent fix.

    My setup: WPMU (w/ subdomains) 3.1 and BP 1.2.8

    The Issue:
    BP users upload avatars, they work fine within the primary BP site, however, on the blogs, they fail. More precisely they show broken image links. The blog authors dropdown in the Buddybar shows broken links, and the users themselves display as broken image links when they comment.

    There have been numerous conversations about this:
    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-show-avatars-uploaded-via-buddypress-in-wordpress-mu/
    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/is-there-any-critical-risk-or-any-other-problem-if-the-previous-bp-core-avatars-php-is-used/#post-new
    http://trac.buddypress.org/ticket/2426

    This issue was present in 1.2.7 (with WP 3.0.5) and still exists with the current stable versions of each software.

    The fix (short-term):
    In the short term, I found some fixes that correct the avatar display problem. This is the current fix I am using: http://theandystratton.com/2010/buddypress-avatars-not-displaying-with-wordpress-3-0

    To summarize the fix, the code below is placed in to bp-custom.php”
    `// 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 fix is broken, however:
    The fix links user avatars to group avatars. Meaning, user avatars show up as belonging to the groups. If the ID number is the same (example: changes to User ID 1, affects the avatar of Group ID 1 and vice-versa). Further, I created a group with an available ID that has already been passed over by the user list. I created the group, but was unable to crop the avatar.

    Fixing the fix, brings back the original problem:
    Removing the fix (or simply commenting it out of bp-custom.php) allows the group avatar to work as designed.

    The result for me (the site developer) and my users:
    I’m forced to make a choice, I have decide which is more important to me since given the current situation I can’t have my cake and eat it too. The BP-avatar display bug on the mu-blogs has been around for years. It keeps being forgotten. It should be considered a critical user interface issue. Without the “band-aid” fix mentioned above, the interaction on the blogs appears broken. With the fix in place, I can have perfect looking blogs, but I cannot have groups (because I consider avatars for this crucial for branding).

    I am not a coder, so I don’t understand how to fix this. I’m hoping that a member of the community, or the developers themselves can put this into the trac system and work this through until it is fixed.

    =============================
    Addendum:
    I also have another bit of code that I picked up someplace else on the net, unfortunately I cannot remember the source of it. I still have it in bp-custom.php, but I have it commented out because it did not fix avatar+mu-blog display problem. It partially corrected, in that avatars were no longer displayed as broken images, but displayed as the generated monster-cons. It changed the paths significantly enough, that if implemented on an established site, all users would be required to re-upload their avatars (this translates to not being a good fix). I am including that bit of code here for reference:


    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);
    `

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.