Opened 15 years ago
Closed 15 years ago
#942 closed defect (bug) (fixed)
WP_CONTENT_URL returns blog url instead of root blog url
Reported by: | mariusooms | Owned by: | |
---|---|---|---|
Milestone: | 1.1 | Priority: | major |
Severity: | Version: | ||
Component: | Keywords: | ||
Cc: |
Description
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.
(In [1697]) Fixes #942