Can you please add a hook to _add_js_css_hooks (), so other components can also use it?


I want to register your plugin with other components which are not part of BuddyPress core.

Currently, the function _add_js_css_hooks () doesn’t allow it ( It only checks for the Activity/Group components).

I have added this filter to the code’s ‘if’ statement:

|| apply_filters( 'bpfb_register_other_components', false )

Can you please add this filter to your next version, so I wont have to update my code on each version?

The complete function now looks like this:

function _add_js_css_hooks () {
global $bp;

if ( (
// Load the scripts on Activity pages
(defined('BP_ACTIVITY_SLUG') && bp_is_activity_component())
// Load the scripts when Activity page is the Home page
(defined('BP_ACTIVITY_SLUG') && 'page' == get_option('show_on_front') && is_front_page() && BP_ACTIVITY_SLUG == get_option('page_on_front'))
// Load the script on Group home page
(defined('BP_GROUPS_SLUG') && bp_is_groups_component() && 'home' == $bp->current_action)
|| apply_filters( 'bpfb_register_other_components', false )
// Step1: Load JS/CSS requirements
add_action('wp_print_scripts', array($this, 'js_plugin_url'));
add_action('wp_print_scripts', array($this, 'js_load_scripts'));
add_action('wp_print_styles', array($this, 'css_load_styles'));