really? No one has a solution?
What version of BuddyPress and WordPress are you using?
We had this same issue with our installation. The problem is in bp_core_avatar_upload_path and bp_core_avatar_url functions located in bp-core/bp-core-avatars.php.
For bp_core_avatar_upload_path I changed this line:
` $upload_dir = WP_CONTENT_DIR . ‘/blogs.dir/’ . BP_ROOT_BLOG . ‘/files/’;`
to:
`$upload_dir = WP_CONTENT_DIR . ‘/uploads’;`
For bp_core_avatar_url I changed this line:
`$upload_dir = str_replace( get_blog_option( $current_blog->blog_id, ‘home’ ) , get_blog_option( BP_ROOT_BLOG, ‘home’ ), $upload_dir );`
to:
`$upload_dir = get_blog_option( BP_ROOT_BLOG, ‘home’ ) . ‘/wp-content/uploads/’;`
This is probably not the best way to fix this but it works.
SInce BP 1.2.6 has the same problem, I would like to open my idea, which is based on @liemcc.
As $upload_dir in bp-core-avatars.php seems to be correct, I changed $upload_dir only.
At line 571 or so,
`[ Original ]
$upload_dir = str_replace( get_blog_option( $current_blog->blog_id, ‘home’ ) , get_blog_option( BP_ROOT_BLOG, ‘home’ ), $upload_dir );
[ Changed ]
$upload_dir = get_home_url( BP_ROOT_BLOG, ‘/’ ) . get_blog_option( BP_ROOT_BLOG, ‘upload_path’);`
Note: There are some other way of correction, and I selected the above becuase I do not want to write the direct path like “/wp-content/” in case upload path changes in the future again.
The reason why we have to change the original script is that WP 3.0.1 has changed upload path for the Blog ID 1 from blogs.dir to “wp^content/uploads” unless we change the default upload path, where “BP_ROOT_BLOG” means Blog ID 1.
I hope this will be helpful for everyone and the next-version BP.
It’s happening again any suggestions?
If you guys have fixed a reproducible bug in 1.2.6, please please make a ticket on http://trac.buddypress.org so we can look at it and/or fix it in core. We can’t read every single thread all of the time on this forum due to time constraints
Hi! I’m having same issue. No avatars on blogs.
On main buddypress blog, avatars works great and their url’s are like this:
http://example.com/wp-content/uploads/avatars/1/aab71f7a93155ef3cabb5d9660686005-bpthumb.jpg
On the other blogs, avatars aren’t displaying. Their url’s are like this:
http://example.com/files/avatars/1/aab71f7a93155ef3cabb5d9660686005-bpthumb.jpg
My installation info:
WP: 3.0.3 (updated from a WP3.0)
BP: 1.2.6
Multisite & subdomains.
My .htaccess:
`# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule . index.php [L]
# END WordPress`
Is it fixed for next release of buddypress? or is there a patch that I could apply?
Thanks at all
Look at the posts above yours: some DID post a patch up above. Did you try it?
did you look at trac to see if a ticket was filed? If not, can you file a ticket?
Yes, I found a ticket filled so I think It will be corrected on next version:
https://trac.buddypress.org/changeset/3141
For the moment, Is there any way to replace by_core_avatar_url() function without hacking de core directly?
Maybe replacing an action or applying a filter?
@overdrive I don’t if it may help you, but helped me:
function bp_core_avatar_url_fix() {
global $current_blog;
// Get upload directory information from current site
$upload_dir = wp_upload_dir();
// If multisite, and current blog does not match root blog, make adjustments
if ( bp_core_is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
$upload_dir = ‘/wp-content/uploads’;
return $upload_dir;
}
add_action( ‘bp_core_avatar_url’, ‘bp_core_avatar_url_fix’);
Thanks @dancort
This works for me