Skip to content

Architecture and Core Classes

BuddyPress Status follows the standard WordPress plugin architecture: a small bootstrap file registers activation, loads the core class, and then hooks into bp_include to start execution after BuddyPress itself is loaded.

The plugin’s entry point is buddypress-status.php. It defines four constants and one function:

Constant Value
BPSTS_PLUGIN_VERSION Current version string (e.g. 3.2.1)
BPSTS_PLUGIN_FILE Absolute path to the main plugin file
BPSTS_PLUGIN_URL URL to the plugin directory
BPSTS_PLUGIN_PATH Filesystem path to the plugin directory
BPSTS_STATUS_MAX_LENGTH Character limit for status text (140)

Execution starts on bp_include, not plugins_loaded, which guarantees BuddyPress is available before any BuddyPress function is called.

add_action( 'bp_include', 'buddypress_status_begin_execution' );
buddypress-status/
├── admin/
│ ├── class-buddypress-status-admin.php
│ ├── css/
│ ├── js/
│ ├── inc/ # Admin tab template partials
│ │ ├── bpsts-setting-general-tab.php
│ │ ├── bpsts-setting-global-status-tab.php
│ │ ├── bpsts-setting-feeling-activities-tab.php
│ │ └── bpsts-welcome-page.php
│ └── wbcom/ # Shared Wbcom admin framework
├── includes/
│ ├── class-buddypress-status.php # Core orchestrator
│ ├── class-buddypress-status-loader.php # Hook queue
│ ├── class-buddypress-status-i18n.php # Translations
│ ├── buddypress-status-general-functions.php # Utility functions
│ └── buddypress-status-emoji-data.php # Emoji dataset
├── public/
│ ├── class-buddypress-status-public.php # Frontend logic
│ ├── css/
│ ├── js/
│ └── inc/
│ └── bpsts-add-status.php # Status form template
├── languages/
├── edd-license/ # EDD license handling
└── buddypress-status.php # Bootstrap

File: includes/class-buddypress-status.php

The orchestrator. Its constructor:

  1. Reads the active theme name and applies the buddypress_status_theme_support filter to determine which theme-specific code paths to activate.
  2. Sets the plugin name (buddypress-status) and version.
  3. Calls load_dependencies(), set_locale(), define_admin_hooks(), and define_public_hooks().

Public methods:

Method Returns Purpose
run() void Fires the loader, which registers all queued hooks
get_plugin_name() string Returns 'buddypress-status'
get_version() string Returns the current version constant
get_loader() Buddypress_Status_Loader Returns the hook loader instance

File: includes/class-buddypress-status-loader.php

Collects add_action and add_filter calls during instantiation, then fires them all when run() is called. This decouples hook registration from hook execution.

File: admin/class-buddypress-status-admin.php

Handles all wp-admin interface work:

  • Registers admin menu pages and settings via admin_menu and admin_init.
  • Enqueues admin-only CSS and JS on admin_enqueue_scripts.
  • Renders the tabbed settings page using partials from admin/inc/.
  • Hides unrelated admin notices on plugin settings pages.

File: public/class-buddypress-status-public.php

All frontend behavior lives here. Key responsibilities:

  • Enqueues CSS and JS on wp_enqueue_scripts (scoped to BuddyPress pages only — activity directory, members directory, groups, and user profiles).
  • Registers the Profile Status sub-navigation item under the BuddyPress profile profile parent nav.
  • Renders the current status in the profile header via bp_before_member_header_meta (or bp_before_member_in_header_meta for BuddyBoss Theme).
  • Renders a truncated status in the members directory via bp_directory_members_item_meta, bp_member_item_meta, bp_nouveau_members_loop_item, and bp_member_members_list_item.
  • Handles all five AJAX actions for status management (add, update, delete, set-current, update-icon).
  • Registers a custom activity_status activity type in BuddyPress and appends mood/feeling data to activity meta.

The buddypress_status_theme_support filter (applied in the constructor) accepts an array of theme slugs. Themes in that array receive additional compatibility code. Out of the box the array contains 'reign-theme' and 'buddyx-pro'.

BuddyBoss Theme is handled via a separate buddypress()->buddyboss check at hook-registration time — it uses a different profile header hook.

Youzify is detected at plugins_loaded priority 20. When Youzify is active, the status form hooks swap from bp_activity_post_form_options to bp_activity_post_form_tools and bp_activity_post_form_after_actions.

Assets are enqueued only on BuddyPress pages. The helper function buddypress_status_get_asset_filename( $type, $filename ) resolves the correct variant to load (minified vs. non-minified, RTL vs. LTR) by checking whether SCRIPT_DEBUG is defined and whether is_rtl() returns true.

Font Awesome 6.5.1 is loaded from cdnjs. If Font Awesome is already registered under common handles (font-awesome, fontawesome, fontawesome5, fontawesome-5, fa), the plugin deregisters those handles and loads version 6.5.1 to avoid conflicts. To prevent the plugin from loading Font Awesome at all, return false from the buddypress_status_load_font_awesome filter.

Text domain: buddypress-status. All user-facing strings pass through standard WordPress i18n functions. The textdomain is loaded on admin_init (not init) via Buddypress_Status_i18n.

The plugin uses Grunt for asset compilation. The gruntfile.js defines tasks for CSS minification, RTL CSS generation, JS minification, and .pot file generation. Source files are in admin/css/, admin/js/, public/css/, and public/js/. Minified and RTL variants are generated artifacts — do not edit them directly.

Terminal window
npm install # Install Grunt and plugins
npm run build # Run full build (cssmin, rtlcss, uglify, makepot)