Support » Plugin: Custom Upload Dir » Cannot Upload Avatars (Buddypress) when using Custom Upload Dir Plugin

  • HI there,

    Firstly, thank you for an awesome plugin, it was exactly what I was looking for to keep some structure on my photoblog: “”.

    I am experiencing a conflict between 2 plugins, “custom upload dir” and “buddypress”.

    The “custom upload dir” plugin works spectacularly well to organise post photos into relevant folders, but I receive an error when attempting to upload an avatar.

    ——————- ERROR ————————————–
    Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘/home/***/wp-content/uploads/avatars/99/3f104f96558228c97963d30bf29e1c7f-bpfull.jpg’ for writing: No such file or directory in /home/***/wp-admin/includes/image.php on line 74

    Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘/home/***/wp-content/uploads/avatars/99/3f104f96558228c97963d30bf29e1c7f-bpthumb.jpg’ for writing: No such file or directory in /home/***/wp-admin/includes/image.php on line 74

    When I disable “custom upload dir”, the error disappears, and i can upload Avatars fine.

    Is there anyway to update the code to only change upload directories for images attached to posts, not ALL the uploads through the entire site? This is all I can think of to make this conflict disappear.

    I want the best of both worlds 🙂

    Your help in this regard would be most appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author ulfben


    Unfortunately no; there’s is no longer any robust way of telling in what context the upload is being triggered.

    But if there is no post, Custom Upload Dir simply ignores the missing values. For instance – if you use %post_title% it will simply be excluded from the path.

    If buddypress uses (or doesn’t inhibit…) wp_handle_upload_prefilter and wp_handle_upload it should work. Are they hardcoding paths anywhere?

    Hi Ulfben,

    Unfortunately my knowledge of PHP is a bit… lacking.

    What I can tell you is that the avatar uploads are supposed to default to wp-content/uploads/avatar/*, however, when I checked the files on the server in the midst of loading the avatars, I see they are being uploaded in the Year/Month folder.

    I also tried altering the avatar.php file which buddypress uses, but obviously I am not getting the language correct becuase it just caused a fatal error.

    Is there anyway that you know of that I could get the avatar.php to load the avatar images and thumbnails into year/month order as I am sure this would help?

    // Set avatar_dir if not passed (uses $object)
    if ( !$avatar_dir ) {
    if ( ‘user’ == $object )
    $avatar_dir = ‘avatars’;
    else if ( bp_is_active( ‘groups’ ) && ‘group’ == $object )
    $avatar_dir = ‘group-avatars’;
    else if ( ‘blog’ == $object )
    $avatar_dir = ‘blog-avatars’;

    $avatar_dir = apply_filters( ‘bp_core_avatar_dir’, $avatar_dir, $object );

    if ( !$avatar_dir )
    return false;
    Your help would be much appreciated, because I definately need to keep the photos uploaded from my users in some order otherwise I am going to go crazy trying to match them up to the correct post.

    Thanks again!

    Plugin Author ulfben


    I usually don’t support other’s plugins. But I think I’ll make an exception here. Partly because I believe the fix can be simple, but also because if it isn’t, it’ll almost certainly be enlightening for my own implementation of the upload_dir / wp_handle_upload filters.

    The WordPress way of dealing with file paths is… a bit opaque methinks. BuddyPress is probably a sane-ish codebase to look to for more insight.

    Besides, I need to update the plugin soon anyway. 🙂

    (not until june though. gotland game conference comes first)

    Thanks so much, that would be much appreciated.

    I eagerly await the update, and thanks again for your help!

    Enjoy the game conference 🙂

    I have the same problem and had to disable Custom Upload Dir so looking forward to the update…

    [ Signature moderated. ]

    Same issue here. Hope you’ll be able to update this great plugin soon.

    May I also have a small fateure request?

    it would be great if there was an optional dropdown menu with fixed upload folders’ list (created in prior of use manually or via the plugin). For instance it would be possible to chose a folder while adding some specific files I wish I uploaded to a different than default folder.

    Plugin Author ulfben


    I couldn’t reproduce this issue. Can someone give exact instructions (from a fresh install of buddypress) to provoke this behaviour?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cannot Upload Avatars (Buddypress) when using Custom Upload Dir Plugin’ is closed to new replies.