Reply To: Avatar across multisite
hi,
Been trying to set this up for a few days now, but no success. I’ve setup a multi-site network with sub-directories and buddypress network activated.
I’ve added define( ‘BP_ENABLE_MULTIBLOG’, true ); to config.php as recommanded for BP multisite install.
Main site: mydomain.com
subsite: mydomain.com/subsite
When users upload their profile picture on main site, unfortunately it doesn’t sync with their profile when they go on the subsite.
The following codes have worked for some people but not for me. Still trying to find a solution.
function bpdev_fix_avatar_dir_path( $path ){
if ( is_multisite() && BP_ENABLE_MULTIBLOG )
$path = ABSPATH . ‘wp-content/uploads/’;
return $path;
}
add_filter( ‘bp_core_avatar_upload_path’, ‘bpdev_fix_avatar_dir_path’, 1 );
//fix the upload dir url
function bpdev_fix_avatar_dir_url( $url ){
if ( is_multisite() )
$url = network_home_url(‘/wp-content/uploads’) ;
return $url;
}
add_filter( ‘bp_core_avatar_url’, ‘bpdev_fix_avatar_dir_url’, 1 );