Skip to content

BuddyPress Newsfeed adds a Newsfeed sub-navigation tab to BuddyPress member activity profiles. The tab aggregates activity from multiple BuddyPress scopes (friends, groups, mentions, favorites, and following) into a single stream. It also optionally filters the main activity directory to show only content relevant to the logged-in user.

This guide covers the plugin’s internal structure, the WordPress and BuddyPress hooks it uses, and where the extension points are.

Constant Value
BNEWS_PLUGIN_VERSION The plugin’s current version string
BNEWS_PLUGIN_FILE Absolute path to the main plugin file
BNEWS_PLUGIN_BASENAME Plugin basename used in plugin_basename() calls
BNEWS_PLUGIN_URL URL to the plugin directory (trailing slash included)
BNEWS_PLUGIN_PATH Filesystem path to the plugin directory (trailing slash included)

All constants are defined in the main bootstrap file (buddypress-newsfeed.php) and guarded with if ( ! defined(...) ) so child plugins or test suites can override them before the plugin loads.

The plugin initialises on bp_include (not plugins_loaded) to ensure BuddyPress is fully loaded before any component is registered.

bp_include
└─ bpnewsfeed_run_plugin()
└─ new Buddypress_Newsfeed()
├─ load_dependencies() - requires admin + public class files
├─ set_locale() - hooks plugins_loaded to load_plugin_textdomain
├─ define_admin_hooks() - enqueue, menu, settings registration
└─ define_public_hooks() - nav items, activity filters, admin bar

A separate admin_init hook (bpnewsfeed_requires_buddypress) shows an admin notice if BuddyPress is not present; the plugin does not deactivate itself. define_public_hooks() registers nothing when the Activity Streams component is off, and the settings page shows a notice instead. A missing edd-license/ folder only turns licence activation and updates off, with an admin notice.

Class File Responsibility
Buddypress_Newsfeed includes/class-buddypress-newsfeed.php Core bootstrapper, wires all hooks via the loader
Buddypress_Newsfeed_Loader includes/class-buddypress-newsfeed-loader.php Stores and runs add_action / add_filter pairs
Buddypress_Newsfeed_I18n includes/class-buddypress-newsfeed-i18n.php Text domain loader
BNEWS_Admin includes/admin/class-bnews-admin.php Settings page (Overview, General, License tabs), menu registration, settings sanitizer, admin stylesheet
Buddypress_Newsfeed_Public public/class-buddypress-newsfeed-public.php Nav tabs, activity query filtering, admin bar

All plugin settings are stored in a single serialised array under the WordPress option key bnews_general_settings. On multisite, each site keeps its own copy. Saving runs through a sanitize callback that keeps only the four known keys.

Default values set on activation:

array(
'disable_all' => 'yes', // merge all scopes into the Newsfeed tab
'first_tab' => 'newsfeed',
'post_form_enable' => 'yes',
)

The _bp_enable_relevant_feed key is not set on activation. It is added to the array only when the site owner turns on the Relevant Activity toggle.

Reading settings anywhere in the codebase:

$settings = get_option( 'bnews_general_settings', array() );

The plugin detects the active BuddyPress environment at runtime:

  • BuddyBoss theme / platform: detected via isset( buddypress()->buddyboss ). When BuddyBoss is active, BuddyBoss’s own templates are used unchanged and the plugin skips the relevant-activity directory filter (BuddyBoss handles that itself).
  • Standard BuddyPress (Nouveau): detected when the BuddyBoss flag is absent. The bp_after_has_activities_parse_args filter is used to modify the activity directory query.

The plugin ships no templates of its own (see Template Overrides).

All translatable strings use the text domain buddypress-newsfeed. Translations belong in the languages/ folder using the standard WordPress format (buddypress-newsfeed-{locale}.po / .mo).