Re: Limit access to Core BP Wigets….
I had the same problem and here’s what worked for me.
Open the file with the widgets in this example bp-core-widgets.php
At the top of the page where the widgets are registered it looks like this:
/* Register widgets for the core component */
function bp_core_register_widgets() {
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Welcome_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Members_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Whos_Online_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Recently_Active_Widget");') );
}
add_action( 'plugins_loaded', 'bp_core_register_widgets' );
replace it with:
* Register widgets for the core component */
function bp_core_register_widgets() {
//global $wpdb, $supporters_widget_main_blog_only;
global $current_blog, $wpdb, $all_bp_widgets_main_blog_only;
//---Config
//
$all_bp_widgets_main_blog_only = 'yes'; //Either 'yes' or 'no'
//
//
if ( $all_bp_widgets_main_blog_only == 'yes' ) {
if ( $wpdb->blogid == 1 ) {
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Welcome_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Members_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Whos_Online_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Recently_Active_Widget");') );
}
}else{
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Welcome_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Members_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Whos_Online_Widget");') );
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Recently_Active_Widget");') );
}
}
add_action( 'plugins_loaded', 'bp_core_register_widgets' );
And that’s it.
Again as I said it seems to work for me but I don’t know if there are any side effects. I recommend testing it before using on live website. Also remember doing the same for the other widgets under blogs, activity etc.I think you will also need to create a different variable than $all_bp_widgets_main_blog_only in the other widget files (blogs, activities etc.)
Maybe some of the gurus here could comment on this approach.