Re: BuddyPress and Multi-Site issues
I’m afraid that many things i changed could be written much more simplier using build in wpmu and buddypress functions so if anybody see such a situation, please write about it here.
I think i finished enabling buddypress sitewide with same data for each site. Last changes i made were made in core files – can i move them somehow outside to leave core files as they are?
Change to bp-core.php enabling buddypress dirs on additional sites:
line 16:
if ( !defined( 'BP_ROOT_BLOG' ) ) {
global $current_blog,$wpdb;
$blog_url = get_blog_option($current_blog->blog_id, 'siteurl' );
$blog_url_pieces = explode("/", $blog_url);
$blog_url_pieces = explode(".", $blog_url_pieces[2]);
if (isset($blog_url_pieces[2]) && $blog_url_pieces[2]!'')
$blog_url = $blog_url_pieces[1].'.'.$blog_url_pieces[2];
else
$blog_url = $blog_url_pieces[0].'.'.$blog_url_pieces[1];
$query = "SELECT * FROM {$wpdb->blogs} WHERE domain='".$blog_url."'";
$blog = $wpdb->get_row($query);
define( 'BP_ROOT_BLOG', $blog->blog_id );
}
Change to bp-core-avatars.php solving issue with wrong avatars urls:
In function bp_core_render_avatar_cropper()
$src = str_replace( array(ABSPATH), get_blog_option( 1, 'siteurl' ).'/', $new );
In function bp_core_get_avatar()
$url =get_blog_option(1, 'siteurl' ) . '/' . $avatar_file;