Skip to content

Hooks Reference

This page documents every filter that BuddyPress Newsfeed owns (calls apply_filters on), and summarises the key BuddyPress hooks the plugin attaches to. Use this page when you need to extend or modify plugin behaviour without editing plugin files.

Filters the array of activity scopes that are merged into the Newsfeed stream.

Location: includes/bnews-general-functions.php, inside bnews_get_act_list()

Signature:

apply_filters( 'bnews_add_activity_lists_to_filter', array $act_list )

Parameter:

Name Type Description
$act_list array Associative array of slug => label pairs. Keys are the BuddyPress activity scope slugs.

Default value of $act_list before the filter fires:

array(
'just-me' => __( 'Personal ...', 'buddypress-newsfeed' ),
'mentions' => __( 'Mentions', 'buddypress-newsfeed' ),
'favorites' => __( 'Favorites', 'buddypress-newsfeed' ),
// 'friends' added when bp_is_active( 'friends' ) is true
// 'groups' added when bp_is_active( 'groups' ) is true
// 'following' added when BP Follow is active or _bp_enable_activity_follow is set
)

Example - add a custom scope to the merged feed:

add_filter( 'bnews_add_activity_lists_to_filter', function( $act_list ) {
$act_list['bookmarks'] = __( 'Bookmarks', 'my-plugin' );
return $act_list;
} );

Example - remove a scope (e.g. Favorites) from the merged feed:

add_filter( 'bnews_add_activity_lists_to_filter', function( $act_list ) {
unset( $act_list['favorites'] );
return $act_list;
} );

Filters the resolved filesystem path for any template the plugin loads through its own template-location function.

Location: includes/bnews-general-functions.php, inside bp_news_feed_locate_template()

Signature:

apply_filters(
'bp_news_feed_locate_template',
string $template,
string $template_name,
string $template_path,
string $default_path
)

Parameters:

Name Type Description
$template string The resolved absolute path (may be empty if not found).
$template_name string Filename being looked up, e.g. parts/bp-whats-new-toolbar.php.
$template_path string Sub-directory passed to the locator, e.g. nouveau.
$default_path string Plugin’s own templates/ path used as fallback.

Template locate flow:

bp_news_feed_locate_template( $name, $path, $default_path )
1. locate_template( [ "{$path}/{$name}", $name ] )
- WordPress searches active theme, then parent theme
2. If nothing found, check {$default_path}{$path}/{$name} (plugin bundled)
3. apply_filters( 'bp_news_feed_locate_template', $template, ... )
- caller can override the resolved path entirely

Example - redirect a specific template to a custom location:

add_filter( 'bp_news_feed_locate_template', function( $template, $name, $path, $default ) {
if ( 'parts/bp-whats-new-toolbar.php' === $name ) {
return get_stylesheet_directory() . '/my-overrides/bp-whats-new-toolbar.php';
}
return $template;
}, 10, 4 );

In the current version, the only template the plugin loads through bp_news_feed_get_template() is parts/bp-whats-new-toolbar.php, and only when BuddyBoss Platform is active. Templates loaded directly by BuddyPress core (e.g. bp_get_template_part( 'activity/post-form' )) do not pass through this filter.


These are the BuddyPress and WordPress hooks the plugin registers callbacks on. They are listed here as a reference for debugging and for developers who need to un-hook plugin behaviour. Registration lives in define_public_hooks() in includes/class-buddypress-newsfeed.php.

Hook Type Priority Callback What it does
bp_setup_nav action 999 bnews_setup_submenu_activity_newsfeed Registers the Newsfeed and Personal sub-nav items under the Activity component
bp_actions filter 10 bnews_newsfeed_activity_feed Removes individual activity sub-nav tabs (favorites, friends, groups, mentions, following) when “Disable for Activity-Specific Tabs” is enabled
bp_before_has_activities_parse_args filter 10 bnews_alter_activities_parse_args Injects the merged scope list into the activity query when the Newsfeed tab is active
bp_after_has_activities_parse_args filter 10 bpnewsfeed_filter_relevant_activity Modifies the activity directory query to show only content relevant to the logged-in user (registered on non-BuddyBoss installs only)
bp_get_template_part filter 10 bpnewsfeed_get_template_part Intercepts the BuddyBoss toolbar template and replaces it with the plugin’s own version (registered on BuddyBoss installs only)
admin_bar_menu action 10 bnews_update_wp_menus Replaces the default “Personal” admin bar activity link with plugin-managed Newsfeed and Personal links
admin_bar_menu action 99 bnews_admin_bar_menu Removes individual activity scope links from the admin bar toolbar when merging is enabled
bp_before_member_activity_post_form action 10 bnews_post_form Renders the activity post form on the Newsfeed tab when the post form option is enabled
bp_activity_single_at_mentions_notification filter 10 bnews_change_mention_notification_link_on_merge Rewrites the mention notification URL to point to the Newsfeed tab instead of the standalone Mentions tab
bp_activity_multiple_at_mentions_notification filter 10 bnews_change_mention_notification_link_on_merge Same as above for multiple-mention notifications
wp_footer action 10 bpnewsfeed_activity_post_form Injects a JS snippet on BuddyBoss to unhide the post form on the Newsfeed tab

The bp_get_template_part and bp_after_has_activities_parse_args bindings are mutually exclusive: the plugin registers the first on BuddyBoss installs and the second on standard BuddyPress installs.

The simplest, supported way to turn off the directory-level relevant feed is to set Enable Relevant Activity to off in the admin settings, rather than unhooking at the PHP level. Because the plugin registers its callbacks as instance methods through a loader, you would need the live Buddypress_Newsfeed_Public instance to call remove_filter(), which the plugin does not expose.