[buddypress-trac] [BuddyPress] #942: WP_CONTENT_URL returns blog url instead of root blog url

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Aug 25 06:59:56 UTC 2009

#942: WP_CONTENT_URL returns blog url instead of root blog url
Reporter:  mariusooms  |       Owner:     
    Type:  defect      |      Status:  new
Priority:  major       |   Milestone:  1.1
Keywords:              |  
 in bp-core-avatars.php the function bp_core_fetch_avatar sets
 WP_CONTENT_URL as part of the $avatar_folder_url variable around line 89.

 The issue is that WP_CONTENT_URL will return a url specific to the
 current_blog, rather than the root blog. WP_CONTENT_DIR does remain
 specific to the root blog.

 When you try to fetch avatars outside of the root blog, the returned url
 will be wrong and actually relative to the current blog.

 The current (ugly) fix 'for me' is the following:

 $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', 'http://'
 . $current_site->domain . $current_site->path . 'wp-content/blogs.dir/' .
 BP_ROOT_BLOG . '/files/' . $avatar_dir . '/' . $item_id, $item_id,
 $object, $avatar_dir );

 The original line is as follows:

 $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url',
 WP_CONTENT_URL . '/blogs.dir/' . BP_ROOT_BLOG . '/files/' . $avatar_dir .
 '/' . $item_id, $item_id, $object, $avatar_dir );

 I imagine there is a better way, maybe a new function called BP_ROOT_URL
 or an existing function I am unaware of.

 On a side note, it almost seems to me this is a WPMU bug since I would
 expect that WP_CONTENT_URL would behave like WP_CONTENT_DIR.

Ticket URL: <http://trac.buddypress.org/ticket/942>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list