Plugin Author
ulfben
(@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?
—————————–CODE——————————-
// 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
(@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
(@ulfben)
I couldn’t reproduce this issue. Can someone give exact instructions (from a fresh install of buddypress) to provoke this behaviour?