Skip to content

Developer Overview

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 Current version string (e.g. 1.8.3)
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) deactivates the plugin and shows an admin notice if BuddyPress is not present.

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
Buddypress_Newsfeed_Admin admin/class-buddypress-newsfeed-admin.php Settings page, menu registration, asset enqueue
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 with network activation, get_site_option is used instead.

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, the plugin hooks bp_get_template_part to inject a custom toolbar template (parts/bp-whats-new-toolbar.php) and 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 also ships a templates/legacy/ folder, but the current version does not load those files (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).