Skip to:

Opened 14 years ago

Closed 14 years ago

#2317 closed defect (bug) (fixed)

Upload Path for Avatars is wrong for Multisite

Reported by: ipstenu's profile ipstenu Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 1.2.4 Priority: major
Severity: Version:
Component: Core Keywords: has-patch, needs-testing


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


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)

avatar-path-and-url-fix-jjj.patch (5.3 KB) - added by johnjamesjacoby 14 years ago.

Download all attachments as: .zip

Change History (8)

#1 @apeatling
14 years ago

  • Milestone changed from 1.3 to 1.2.4
  • Priority changed from normal to major

#2 @boonebgorges
14 years ago

  • Keywords has-patch added

#3 @johnjamesjacoby
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 @johnjamesjacoby
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.

#5 @johnjamesjacoby
14 years ago

  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#6 @apeatling
14 years ago

Getting a "There was a problem cropping your avatar, please try uploading it again" when trying to crop avatars with this patch.

#7 @apeatling
14 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [2984]) Fixes #2317 props jjj

Note: See TracTickets for help on using tickets.