Avatars in Recent Site Wide Posts not inSync with Buddypress Avatars

I recently upgraded to buddypress 1.1.1 and since then my avatars for my Recent Site Wide Posts have dissapeared.

Some are still there, but the majority have gone.

Any idea how that happened and how I can fix that?

George

  • mirozake
    • New Recruit

    I have one fresh installe of wpmu and buddypress 1.1.1, without your avatar plugin, and no avatars show. anywhere. period. not a big deal (for now). but there is definitly something weird going on with the new buddypress 1.1.1.. I re-uploading pertinent core files, and reinstalling buddypress at there next update..

    so.. just my 2 cents

  • Andrew
    • Champion of Loops

    Just so I know the rules, should I not be posting BP problems in this forum?

    Nah, you’re 100% in the clear posting them here. Just include a bit about the issue not being related to our plugins, etc. On this one it wasn’t clear if you were referring to our avatars plugin and our recent posts plugin or something else.

    Thanks,

    Andrew

  • georgef
    • The Incredible Code Injector

    OK, wondering if someone here can help me with some clarity on the possible solution that I’ve found.

    Not having much luck with anyone replying in the Buddypress forum. I’ve tried this, but it hasnt fixed the problem yet…

    This was posted by Andy Peatling:

    So – in 1.1 BuddyPress does not query the database to fetch avatars, it expects them to be in specific folders and with specific names.

    Likely what it happening is the permissions on the folders denied BuddyPress the access it needed to move avatars around and into the format/location needed for 1.1. Most of the problems will be related to group avatars mixing up with user avatars, as they were in the same folder for 1.0.

    The quickest option is to remove the /wp-content/blogs.dir/1/files/avatars/ directory and let BuddyPress rebuild your avatars as people upload again. Anyone who has a Gravatar will revert back to that image, so not all will be lost.

    Other than that, you can use this code below to place group avatars in the correct place, so they don’t conflict with user avatars (this normally runs on upgrade). Make sure the permissions on the avatar folder allow for BuddyPress to move files around.

    function move_group_avatars() {

    /* On upgrade, handle moving of old group avatars */

    $groups = groups_get_all();

    foreach ( $groups as $group ) {

    /* Don’t fetch and move gravs, default images or empties */

    if ( empty($group->avatar_thumb) || strpos( $group->avatar_thumb, ‘gravatar.com’ ) || strpos( $group->avatar_thumb, ‘identicon’ ) || strpos( $group->avatar_thumb, ‘none-thumbnail’ ) )

    continue;

    $start = strpos( $group->avatar_thumb, ‘blogs.dir’ );

    if ( false !== $start ) {

    $avatar_thumb = WP_CONTENT_DIR . ‘/’ . substr( $group->avatar_thumb, $start, strlen( $group->avatar_thumb ) );

    $avatar_full = WP_CONTENT_DIR . ‘/’ . substr( $group->avatar_full, $start, strlen( $group->avatar_full ) );

    if ( !file_exists( $avatar_thumb ) || !file_exists( $avatar_full ) )

    continue;

    $upload_dir = groups_avatar_upload_dir( $group->id );

    copy( $avatar_thumb, $upload_dir . ‘/’ . basename($avatar_thumb) );

    copy( $avatar_full, $upload_dir . ‘/’ . basename($avatar_full) );

    unlink( $avatar_thumb );

    unlink( $avatar_full );

    }

    }

    }

    add_action( ‘plugins_loaded’, ‘move_group_avatars’ );

    Put that somewhere so it can run, maybe temporarily paste it at the top of bp-core.php, then remove it when you are done.

    I have tried the code, but not to delete the avatars folder. This concerns me though:

    Anyone who has a Gravatar will revert back to that image, so not all will be lost.

    Does that mean you will lose some avatars fixing it this way?

    I placed the code bp-core.php as suggested.

    Thanks,

    George

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.