Re: Can’t activate BuddyPress
I disabled the default BP function to add all blogs to BP DB table with `add_site_option(‘bp-blogs-first-install’, 1);`
Instead I do my own BP blogs installation for each blog during upgrade:
`function bp_blogs_install_after_multisite_upgrade($blog_id) {
echo(‘Blog ID ‘ . $blog_id . ‘:
‘);
if(!get_blog_option($blog_id, ‘bp-blog-recorded’)) {
$users = get_users_of_blog( $blog_id );
if ( $users ) {
foreach ( (array)$users as $user ) {
$role = unserialize( $user->meta_value );
if ( !isset( $role ) )
bp_blogs_record_blog( $blog_id, $user->user_id, true );
}
add_blog_option($blog_id, ‘bp-blog-recorded’, ‘true’);
echo(‘Blog ID ‘ . $blog_id . ‘ added to BuddyPress database.
‘);
}
} else {
echo(‘Blog ID ‘ . $blog_id . ‘ already in BuddyPress.
‘);
}
}
add_site_option(‘bp-blogs-first-install’, 1);
add_action(‘wpmu_upgrade_site’, ‘bp_blogs_install_after_multisite_upgrade’);
`