Architecture Overview

Get Started

Understanding the internal structure and design of BuddyPress Moderation Pro for developers who want to extend or customize the plugin.

Directory Structure

The plugin follows WordPress coding standards with a clear separation of concerns:

  • includes/ – Core functionality and shared classes
  • admin/ – Admin panel, settings tabs, and meta boxes
  • public/ – Frontend UI, content handlers, and AJAX endpoints
  • templates/ – Overridable template files
  • languages/ – Translation files

Core Classes

Main Orchestrator

Buddypress_Moderation_Pro (includes/class-buddypress-moderation-pro.php) is the main plugin class that:

  • Defines plugin constants
  • Loads all dependencies
  • Sets locale for internationalization
  • Initializes admin and public hooks

Hook Loader

Buddypress_Moderation_Pro_Loader provides centralized hook registration, queuing all actions and filters before executing them.

Content Type Handlers

Each content type has a dedicated handler class:

Handler ClassPurpose
Activity_ModerationActivity stream posts
Comments_ModerationActivity comments
Members_ModerationMember profiles and blocking
Groups_ModerationBuddyPress groups
Messages_ModerationPrivate messages
Topics_ModerationbbPress forum topics
Replies_ModerationbbPress forum replies
Avatar_ModerationProfile and group avatars

Data Flow

Report Submission Flow

  1. User clicks flag button → JavaScript opens modal
  2. User fills form with reason and details
  3. AJAX request sent with nonce verification
  4. PHP handler validates input and checks permissions
  5. Report post created (bmpro_spam post type)
  6. Meta data updated (reporter list, content meta)
  7. Action hooks fired (bpmp_*_flagged)
  8. Notifications sent (email and BuddyPress)
  9. Auto-moderation threshold checked
  10. Content hidden if threshold met

Content Visibility Flow

  1. Content query requested
  2. Filter hook fires (bp_ajax_querystring)
  3. Get excluded IDs via bmpro_exclude_moderated_content()
  4. Check user context (admin, reporter, content owner)
  5. Return content with flag indicator OR filter out from query

Database Schema

Custom Post Types

bmpro_spam – Report Log entries stored in wp_posts table

Key Meta Fields:

  • bmpro_spam_activity_id – Original content ID
  • bmpro_spam_reported_by – Array of reporter user IDs
  • bmpro_spam_status – awaiting_moderation or spam
  • bmpro_hide_mode – reporters or all_users
  • bmpro_member_actions – Actions taken on member
  • bmpro_lock_member_account – Account lock status

bmpro_avatar_spam – Avatar moderation entries

Key Meta Fields:

  • _bp_user_id – User ID for profile avatars
  • _bp_group_id – Group ID for group avatars
  • _bp_user_avatar_flag – 0=pending, 1=approved, 2=rejected
  • _bp_is_group_avatar – Boolean for group avatars

Taxonomy

The bmpro_content_type taxonomy categorizes reports with terms: activity_update, activity_comment, member, group, message, topic, reply, group_avatar, user_avatar

Caching System

The plugin includes a performance caching system (class-bmpro-cache.php) providing:

  • Batch preloading – Fetches moderation data in single queries when activity loops start
  • Object caching – Uses wp_cache for persistent caching (works with Redis/Memcached)
  • Runtime cache – Fast in-memory cache for current request
  • Auto-invalidation – Cache cleared when data changes

Cache Keys

  • activity_mod_{id} – Activity moderation status
  • member_flagged_meta_{id} – Member flagged status
  • user_block_{id} – User’s block list
  • user_blocked_by_{id} – Who has blocked this user
  • user_flagged_{id} – User’s flagged activities

Template System

Templates in the templates/ directory can be overridden in your theme:

  • bmpo-bp-moderations.php – Moderation queue template
  • blocking.php – Block user interface
  • blocked.php – Blocked members list

Copy templates to your-theme/buddypress-moderation-pro/ to customize.

Last updated: January 28, 2026