Skip to:
Content
Pages
Categories
Search
Top
Bottom

Group Avatar not uploading

  • @prometheus-fire

    Participant

    This is kind of a long problem because there is a history to it but I think I’ve turned it into a legacy problem.

    I started out with WP multisite and BP 1.2.5. Back when I originally installed everything, there was a known problem with user avatars displaying in the comments in sub-blogs. It was simply a broken image path. After much searching, I found the code snippet below to straighten out the user avatar path and it fixed the problem.

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

    I have that code in bp-custom.php

    I was able to operate for a long time with that bit of code because I wasn’t using BuddyPress groups. It turns out, with that code snippet the group avatars and user avatars get confused. If the numeric id for the group was the same as that for a user, then whenever the avatar for either one was changed then it would update for both. It linked the two together.

    Because I haven’t been using groups, it wasn’t a big deal, but now I’m looking at using groups. I found a workaround by going into the database and changing the group id number of the most recently created group to an ungodly high number (1000001). Since I’m never going to get that many members on my site, now all newly created groups are id’d sequentially after that number. So now I think I’m fine, I should be able to upload group avatars without it affecting the user avatars.

    Only it doesn’t work.

    Uploading a group avatar errors out with “problem cropping…”.

    I’m guessing that it is because I screwed up the avatar paths so long ago with that code snippet.

    I tested by removing that snippet to see how things went and the user avatars went back to not showing up in the comments on the sub-blogs. Okay, that’s expected (sort of), so I attempted to upload a user avatar under the organic paths that are in BP 1.5 and it failed (I tried about 10 times to be sure).

    So now I’ve got the code snippet re-enabled in bp-custom.php but I can’t upload group avatars.

    Questions:
    How do I fix this?
    What is BP 1.5’s default path for user and group avatars?
    If I manage to fix this, am I going to have to ask all my users to reupload their avatars?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Group Avatar not uploading’ is closed to new replies.
Skip to toolbar