Opened 14 years ago
Closed 14 years ago
#2317 closed defect (bug) (fixed)
Upload Path for Avatars is wrong for Multisite
Reported by: | ipstenu | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 1.2.4 | Priority: | major |
Severity: | Version: | ||
Component: | Core | Keywords: | has-patch, needs-testing |
Cc: |
Description
I don't know if this is a WP 3.0 issue or not, but it has an easy fix.
When I tried to upload group avatars, it was trying to put the images in
/group-avatars/1/
It looks like this function isn't working right from bp-core-avatars.php
function bp_core_avatar_upload_path() { if ( bp_core_is_multisite() ) $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, 'upload_path' ); else { if ( !$path = get_option( 'upload_path' ) ) $path = WP_CONTENT_DIR . '/uploads'; } return apply_filters( 'bp_core_avatar_upload_path', $path ); }
Calling upload_path is wrong. It should be upload_url_path
Once I changed it, it worked like a charm.
Attachments (1)
Change History (8)
#3
@
14 years ago
- Keywords needs-testing added
Added a patch that seems to fix it on WPMU2.9.2 and WP3.0 trunk.
It's a little more elaborate than I'd like to put into a point release, but it's passed my tests.
The problem is the difference between WP and WPMU, and how they allow you to modify the uploads directory. MU doesn't adhere to using its own UPLOADBLOGSDIR in the proper places (appears fixed in 3.0) so in some cases the BP_AVATAR_UPLOAD_PATH may not contain WP_CONTENT_DIR while still containing "blogs.dir".
Please test this rigorously if you can. Also experiment with changing the upload directory in single site setups under 'admin > media >'
#4
@
14 years ago
The reason why it isn't as simple as just changing from 'upload_path' to 'upload_url_path' is because there is no fall-back handling built into BuddyPress in the event that either of those fields are not populated.
The 'wp_upload_dir' function handles this quite nicely, so even if the rest of this patch is rubbish, it would be nice to try to use 'wp_upload_dir' as our starting off point.
needs-testing