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 hooks into bp_include to start execution after BuddyPress is loaded.

The plugin’s entry point is buddypress-status.php. It defines these constants:

Constant Value
BPSTS_PLUGIN_VERSION Current version string (3.3.0)
BPSTS_PLUGIN_FILE Absolute path to the main plugin file
BPSTS_PLUGIN_BASENAME plugin_basename() of the main 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 # Legacy class: register_setting x3 + sanitizers only
│ └── index.php
├── assets/
│ ├── css/ # Admin card-panel styles (admin.css, admin-settings.css)
│ ├── js/ # Admin JS (admin.js)
│ └── vendor/fontawesome/ # Bundled Font Awesome 6.5.1 (css + webfonts)
├── 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 # Helper functions and most filters
│ ├── buddypress-status-emoji-data.php # Emoji dataset
│ └── admin/
│ ├── class-bpsts-admin.php # Admin card-panel controller
│ └── views/ # Tab view partials (shell, hub, overview,
│ # settings-general, settings-global-status,
│ # settings-feeling-activities, faq, license)
├── public/
│ ├── class-buddypress-status-public.php # Frontend logic and AJAX handlers
│ ├── css/
│ ├── js/
│ ├── icons/
│ └── inc/
│ └── bpsts-add-status.php # Status form template
├── edd-license/ # EDD license client + updater
├── languages/
└── buddypress-status.php # Bootstrap

File: includes/class-buddypress-status.php

The orchestrator. Its constructor:

  1. Applies the buddypress_status_theme_support filter to decide which theme-specific code paths to activate (default array( 'reign-theme', 'buddyx-pro' )).
  2. Sets the plugin name (buddypress-status) and version.
  3. Calls load_dependencies(), set_locale(), define_admin_hooks(), and define_public_hooks().

Public methods: run() (fires the loader), get_plugin_name(), get_version(), get_loader().

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

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

File: includes/admin/class-bpsts-admin.php

Owns the wp-admin interface (the 3.3.0 card-panel migration):

  • Registers the shared WB Plugins top-level menu and the BP Status submenu on admin_menu (menu slug buddypress_status).
  • Renders the six-tab settings page (Overview, General, Global Status, Feeling Activities, Support, License) from the partials in includes/admin/views/.
  • Enqueues admin CSS/JS and the bundled Font Awesome on its own screens only.

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

Retained only to register the three settings groups (register_setting x3) and their sanitizers (sanitize_general_settings, sanitize_global_statuses, sanitize_feeling_activities) on admin_init. It no longer renders menus or pages.

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

All frontend behaviour lives here:

  • Enqueues CSS and JS on BuddyPress pages (activity, members, groups, and user profiles).
  • Registers the profile status sub-navigation item.
  • 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 the five AJAX actions (add, update, delete, set-current, update-icon).
  • Registers a custom activity_status activity type and appends mood/feeling data to activity meta.

The buddypress_status_theme_support filter accepts an array of theme slugs; themes in that array receive extra compatibility code. Out of the box the array contains 'reign-theme' and 'buddyx-pro'. BuddyBoss Theme is handled by a separate check that swaps the profile-header hook. Youzify, when active, adds the status form via Youzify’s own header hook.

Assets are enqueued only on BuddyPress pages. Font Awesome 6.5.1 is bundled with the plugin and served from assets/vendor/fontawesome/, not from an external CDN. To avoid conflicts, the public class deregisters common Font Awesome style handles registered by other plugins or themes (font-awesome, fontawesome, font-awesome-4/5/6, fontawesome-all, font-awesome-pro, and similar) before loading its own copy.

Text domain: buddypress-status. All user-facing strings pass through standard WordPress i18n functions, and translation loading is handled by Buddypress_Status_i18n.

The plugin uses Grunt (gruntfile.js) for CSS minification, RTL CSS generation, JS minification, and .pot generation. Minified and RTL variants are generated artifacts; do not edit them directly.

Terminal window
npm install # Install Grunt and plugins
npm run build # Run the full build