Skip to content

Complete reference for all public functions, classes, and APIs in BuddyPress Moderation Pro.



Get available spam status types for filtering.

Returns: array - Associative array of status slugs and labels

Example:

$statuses = bmpro_spam_statuses();
// Returns:
// array(
// '' => 'All',
// 'pending' => 'Pending',
// 'spam' => 'Spam',
// 'approved'=> 'Approved'
// )

Filter: bmpro_spam_statuses_types


Get array of content types available for flagging/moderation.

Returns: array - Associative array of content type slugs and labels

Example:

$content_types = bmpro_content_to_flag_array();
// Returns:
// array(
// 'restrictions' => 'Restrictions',
// 'profile_avatar' => 'Avatar Moderation',
// 'reported-keyword' => 'Categorize By Report'
// )

Filter: bmpro_content_to_flag


Get the auto-moderation report threshold.

Returns: int - Number of reports required before auto-moderation triggers

Default: 5

Example:

$threshold = bmpro_auto_mod_limit_count();
if ( $report_count >= $threshold ) {
// Auto-hide content
}

Filter: bmpro_auto_mod_limit_filter


bmpro_auto_moderation_enable( $component )

Section titled “bmpro_auto_moderation_enable( $component )”

Check if auto-moderation is enabled for a specific component.

Parameters:

Name Type Description
$component string Component name: activity, member, group, message, topic, reply

Returns: bool - Whether auto-moderation is enabled

Example:

if ( bmpro_auto_moderation_enable( 'activity' ) ) {
// Check report count and auto-moderate
}

Filter: bmpro_auto_moderation_enable


Get the visibility mode for moderated content.

Returns: string - Either 'reporters' or 'all_users'

Value Description
reporters Hidden content visible only to reporter and admins
all_users Hidden content invisible to everyone except admins

Example:

$visibility = bmpro_get_moderation_content_visibility();
if ( $visibility === 'reporters' ) {
// Show content to reporter only
}

Filter: bmpro_get_moderation_mode_filter


Check if a user has permission to report content.

Parameters:

Name Type Default Description
$user_id int 0 User ID (0 for current user)

Returns: bool - Whether user can report content

Example:

if ( bmpro_user_can_report() ) {
// Show report button
echo '<button class="bmpro-flag-btn">Report</button>';
}

Filter: bmpro_user_can_report


Get users by WordPress role.

Parameters:

Name Type Description
$role string WordPress role slug

Returns: array - Array of WP_User objects

Example:

$moderators = bmpro_get_users( 'bp_moderator_pro' );
foreach ( $moderators as $moderator ) {
echo $moderator->display_name;
}

Filter: bpmp_get_users


bmpro_get_moderator_users( $role = ‘’ )

Section titled “bmpro_get_moderator_users( $role = ‘’ )”

Get moderator users with fallback to administrators.

Parameters:

Name Type Default Description
$role string ‘’ Optional specific role

Returns: array|bool - Array of user IDs or false

Example:

$moderator_ids = bmpro_get_moderator_users();
if ( in_array( get_current_user_id(), $moderator_ids ) ) {
// User is a moderator
}

Filter: bpmp_moderator_users


Get the BuddyPress profile URL for a user (BP 12.0+ compatible).

Parameters:

Name Type Description
$author_id int User ID

Returns: string - Profile URL

Example:

$profile_url = bmpro_members_get_user_url( 123 );
echo '<a href="' . esc_url( $profile_url ) . '">View Profile</a>';

Filter: bpmp_members_get_user_url


bmpro_get_activity_post_status( $activity_id, $meta_key = ‘’ )

Section titled “bmpro_get_activity_post_status( $activity_id, $meta_key = ‘’ )”

Get the moderation/spam status for an activity.

Parameters:

Name Type Default Description
$activity_id int - Activity ID
$meta_key string ‘’ Optional specific meta key

Returns: mixed - Status value or array of statuses

Example:

$status = bmpro_get_activity_post_status( $activity_id );
if ( $status === 'spam' ) {
// Activity is marked as spam
}

Filter: bmpro_get_activity_post_status_filter


bmpro_exclude_moderated_content( $object, $object_id )

Section titled “bmpro_exclude_moderated_content( $object, $object_id )”

Check if content should be excluded/hidden from display.

Parameters:

Name Type Description
$object string Object type: activity, member, group, etc.
$object_id int Object ID

Returns: bool - Whether content should be hidden

Example:

if ( bmpro_exclude_moderated_content( 'activity', $activity_id ) ) {
// Don't display this activity
continue;
}

Filter: bmpro_exclude_moderated_content


bmpro_get_reports_count( $object_id, $object )

Section titled “bmpro_get_reports_count( $object_id, $object )”

Get the number of reports and list of reporters for content.

Parameters:

Name Type Description
$object_id int Object ID
$object string Object type

Returns: array - Array with count and reporters keys

Example:

$reports = bmpro_get_reports_count( $activity_id, 'activity' );
echo 'This content has ' . $reports['count'] . ' reports';
// $reports['reporters'] contains array of user IDs

Filter: bmpro_count_reporters_filter


bmpro_is_enabled_flagging( $content_type )

Section titled “bmpro_is_enabled_flagging( $content_type )”

Check if flagging is enabled for a content type.

Parameters:

Name Type Description
$content_type string Content type slug

Returns: bool - Whether flagging is enabled

Note: This function is deprecated but maintained for backward compatibility.

Example:

if ( bmpro_is_enabled_flagging( 'activity' ) ) {
// Show flag button
}

Filter: bmpro_get_is_enabled_flagging


Get the spam report post ID for an activity (with caching).

Parameters:

Name Type Description
$activity_id int Activity ID

Returns: int|null - Spam post ID or null

Example:

$spam_post_id = bmpro_get_spam_post_id( $activity_id );
if ( $spam_post_id ) {
$report_url = get_edit_post_link( $spam_post_id );
}

Batch preload spam data for multiple activities (performance optimization).

Parameters:

Name Type Description
$activity_ids array Array of activity IDs

Returns: void

Example:

// Before looping through activities
$activity_ids = wp_list_pluck( $activities, 'id' );
bmpro_preload_spam_data( $activity_ids );
// Now individual lookups are cached
foreach ( $activities as $activity ) {
$spam_id = bmpro_get_spam_post_id( $activity->id );
}

Get available moderation actions for reported members.

Returns: array - Associative array of action slugs and labels

Example:

$actions = bmpro_member_related_actions();
// Returns:
// array(
// 'no_action' => 'No action',
// 'spammer' => 'Mark user as spammer',
// 'suspend' => 'Suspend account',
// ...
// )

Filter: bmpro_member_related_actions_filter


Get available moderation actions for reported groups.

Returns: array - Associative array of action slugs and labels

Example:

$actions = bmpro_group_related_actions();
foreach ( $actions as $slug => $label ) {
echo "<option value='{$slug}'>{$label}</option>";
}

Filter: bmpro_group_related_actions_filter


Get configured member restriction settings.

Returns: array - Array of enabled restriction slugs

Available Restrictions:

Slug Description
dir_hide Hide from member directory
block_updates Block activity updates
disable_pm Disable private messaging
restrict_comments Restrict commenting

Example:

$restrictions = bmpro_members_moderation_restrictions();
if ( in_array( 'disable_pm', $restrictions ) ) {
// PM restriction is enabled
}

Filter: bmpro_members_moderation_restrictions_filter


Get configured group restriction settings.

Returns: array - Array of enabled restriction slugs

Example:

$restrictions = bmpro_groups_moderation_restrictions();

Filter: bmpro_groups_moderation_restrictions_filter


Section titled “bmpro_check_related_actions( $object_id, $action, $value )”

Check if a specific moderation action is applied to an object.

Parameters:

Name Type Description
$object_id int Object ID (user or group)
$action string Action type
$value string Expected value

Returns: bool - Whether action is applied

Example:

if ( bmpro_check_related_actions( $user_id, 'suspend', 'yes' ) ) {
// User is suspended
wp_die( 'Your account is suspended.' );
}

Get the custom message shown to locked accounts.

Returns: string - Lock message (HTML allowed)

Default: “Your account has been locked due to policy violations.”

Example:

if ( $is_locked ) {
echo '<div class="error">' . bmpro_get_account_lock_message() . '</div>';
}

Filter: bmpro_account_lock_message_filter


bmpro_get_last_avatar_spam_post_id( $user_id )

Section titled “bmpro_get_last_avatar_spam_post_id( $user_id )”

Get the pending avatar moderation post for a user.

Parameters:

Name Type Description
$user_id int User ID

Returns: int|null - Avatar spam post ID or null

Example:

$avatar_post_id = bmpro_get_last_avatar_spam_post_id( $user_id );
if ( $avatar_post_id ) {
$status = get_post_meta( $avatar_post_id, '_bp_user_avatar_flag', true );
// 0 = pending, 1 = approved, 2 = rejected
}

bmpro_get_last_group_avatar_spam_post_id( $group_id )

Section titled “bmpro_get_last_group_avatar_spam_post_id( $group_id )”

Get the pending avatar moderation post for a group.

Parameters:

Name Type Description
$group_id int Group ID

Returns: int|null - Avatar spam post ID or null

Example:

$avatar_post_id = bmpro_get_last_group_avatar_spam_post_id( $group_id );
if ( $avatar_post_id ) {
// Group has pending avatar
}

Clean up flagged activity update data when report is resolved.

Returns: void

Triggered by: Admin action on spam post


Clean up flagged activity comment data when report is resolved.

Returns: void


Clean up flagged private message data when report is resolved.

Returns: void


Clean up flagged member data when report is resolved.

Returns: void


Clean up flagged group data when report is resolved.

Returns: void


Clean up flagged bbPress topic data when report is resolved.

Returns: void


Clean up flagged bbPress reply data when report is resolved.

Returns: void


Get customized flag/unflag button text.

Parameters:

Name Type Description
$text string Text type: 'flag' or 'unflag'

Returns: string - Customized button text

Example:

$flag_text = bmpro_get_flag_button_text( 'flag' );
$unflag_text = bmpro_get_flag_button_text( 'unflag' );
echo "<button class='flag-btn'>{$flag_text}</button>";

Filter: bmpro_get_flag_unflag_text


Count total unique reporters across all flagged content.

Returns: int - Total reporter count

Example:

$total_reporters = bmpro_count_reporters();
echo "Total users who reported content: {$total_reporters}";

Check if BuddyPress Nouveau template pack is active.

Returns: bool

Example:

if ( bmpro_is_nouveau_active() ) {
// Use Nouveau-specific markup
}

Check if BuddyPress Legacy template pack is active.

Returns: bool


Get list of themes with built-in moderation styling support.

Returns: array - Array of theme slugs

Default: array( 'reign-theme', 'buddyx', 'buddyx-pro' )

Filter: buddypress_moderation_theme_suuport


Check if current page should load moderation assets.

Returns: bool

Example:

if ( bmpro_get_is_relevant_buddypress_page() ) {
wp_enqueue_script( 'bmpro-frontend' );
}

bmpro_render_report_modal( $modal_type, $report_subjects, $hidden_fields, $submit_button_id, $modal_title )

Section titled “bmpro_render_report_modal( $modal_type, $report_subjects, $hidden_fields, $submit_button_id, $modal_title )”

Render an accessible report modal dialog.

Parameters:

Name Type Description
$modal_type string Modal identifier
$report_subjects array Report reason options
$hidden_fields array Hidden form fields
$submit_button_id string Submit button element ID
$modal_title string Modal dialog title

Returns: string - Modal HTML

Example:

$hidden = array(
'activity_id' => $activity_id,
'action' => 'bmpro_flag_activity_function'
);
$subjects = array(
'Spam',
'Harassment',
'Inappropriate Content'
);
echo bmpro_render_report_modal(
'activity-report',
$subjects,
$hidden,
'bmpro-submit-activity-report',
__( 'Report Activity', 'buddypress-moderation-pro' )
);

bmpro_email_notification_is_enable( $key )

Section titled “bmpro_email_notification_is_enable( $key )”

Check if email notifications are enabled for a specific type.

Parameters:

Name Type Description
$key string Notification key: 'admin' or 'moderator'

Returns: bool

Example:

if ( bmpro_email_notification_is_enable( 'admin' ) ) {
wp_mail( $admin_email, 'New Report', $message );
}

Filter: bmpro_filter_enabled_admin_flag_email


Check if BuddyPress notifications are enabled for a specific type.

Parameters:

Name Type Description
$key string Notification key

Returns: bool

Example:

if ( bmpro_bp_notification_is_enable( 'admin' ) ) {
bp_notifications_add_notification( array(
'user_id' => $admin_id,
// ...
) );
}

Filter: bmpro_filter_enabled_bp_notification


Load admin settings tab template.

Parameters:

Name Type Description
$current string Current tab slug

Returns: void


Report log for flagged content.

Supports: title, author

Post Meta:

Key Type Description
bmpro_spam_activity_id int Original content ID
bmpro_spam_reported_by array Reporter user IDs
bmpro_spam_status string 'awaiting_moderation' or 'spam'
bmpro_hide_mode string 'reporters' or 'all_users'
bmpro_member_actions array Member moderation actions
bmpro_groups_actions array Group moderation actions
bmpro_lock_member_account string 'yes' if locked
bmpro_account_lock_message string Custom lock message
activity_reports array Report details

Avatar moderation reports.

Post Meta:

Key Type Description
_bp_user_id int User ID (for profile avatars)
_bp_group_id int Group ID (for group avatars)
_bp_user_avatar_flag int 0=pending, 1=approved, 2=rejected
_bp_group_avatar_flag int 0=pending, 1=approved, 2=rejected
_bp_is_group_avatar bool True for group avatars

Categorizes spam reports by content type.

Terms:

  • activity_update
  • activity_comment
  • member
  • group
  • message
  • topic
  • reply
  • group_avatar
  • user_avatar
Key Type Description
bmpro_flagged_activities array Flagged content tracking
bmpro_member_punish string Punishment status
bmpro_flagged_member_meta array Reporter info
Key Type Description
bmpro_flagged_activity_meta array Reporter list
_bp_moderation int Auto-moderation flag (1=moderated)
Key Type Description
bmpro_flagged_group_meta array Reporter list

All AJAX endpoints require authentication and nonce verification.

Action Description
bmpro_flag_activity_report Show activity report modal
bmpro_flag_activity_function Submit activity report
bmpro_unflag_activity_function Remove activity flag
Action Description
bmpro_flag_comment_report Show comment report modal
bmpro_flag_comment_function Submit comment report
bmpro_unflag_comment_function Remove comment flag
Action Description
bmpro_flag_member_report Show member report modal
bmpro_flag_member_function Submit member report
bmpro_unflag_member_function Remove member flag
Action Description
bmpro_flag_group_report Show group report modal
bmpro_flag_group_function Submit group report
bmpro_unflag_group_function Remove group flag
Action Description
bmpro_flag_message_report Show message report modal
bmpro_flag_message_function Submit message report
bmpro_unflag_message_function Remove message flag
Action Description
bmpro_flag_topic_report Show topic report modal
bmpro_flag_topic_function Submit topic report
bmpro_unflag_topic_function Remove topic flag
bmpro_flag_reply_report Show reply report modal
bmpro_flag_reply_function Submit reply report
bmpro_unflag_reply_function Remove reply flag
Action Description
bmpro_spam_cleanup_function Mark content as clean
bmpro_spam_delete_function Delete spam record
bmpro_spam_hide_function Hide content
bmpro_spam_member_lock_function Lock member account
bmpro_spam_author_punish_function Apply author punishment
bmpro_approve_avatar_function Approve avatar
// Success
{
success: true,
data: {
message: 'Report submitted successfully',
// Additional data
}
}
// Error
{
success: false,
data: {
message: 'Error message'
}
}

The plugin extends the BuddyPress activity REST endpoint to include moderation data.

Filter: bp_rest_activity_prepare_value

Added Fields:

{
"bmpro_is_flagged": true,
"bmpro_report_count": 3,
"bmpro_can_report": true
}

// Available after enqueuing moderation scripts
window.bmpro_ajax_object = {
ajax_url: '/wp-admin/admin-ajax.php',
ajax_nonce: 'abc123...',
flag_text: 'Flag',
unflag_text: 'Unflag',
rreport_successfull: 'Report submitted successfully',
required_report_description: 'Please provide a description',
avatar_moderation_message: 'Your avatar is pending approval',
group_avatar_moderation_message: 'Group avatar is pending approval'
};
// Listen for report submission
jQuery(document).on('bmpro:report:submitted', function(e, data) {
console.log('Report submitted:', data);
});
// Listen for modal open
jQuery(document).on('bmpro:modal:opened', function(e, modalType) {
console.log('Modal opened:', modalType);
});

BuddyPress Moderation Pro includes a performance caching layer (BMPRO_Cache class) that reduces database queries through batch preloading and multi-layer caching.

Get the singleton cache instance.

Returns: BMPRO_Cache - Cache manager instance

Example:

$cache = bmpro_cache();
$data = $cache->get_activity_moderation( $activity_id );

Get moderation data for an activity, with automatic caching.

Parameters:

  • $activity_id (int) - Activity ID to check

Returns: array|false - Moderation data or false if not moderated

Example:

$cache = bmpro_cache();
$mod_data = $cache->get_activity_moderation( 123 );
if ( $mod_data ) {
echo 'Activity is moderated. Status: ' . $mod_data['status'];
}

BMPRO_Cache::batch_load_activity_moderation()

Section titled “BMPRO_Cache::batch_load_activity_moderation()”

Preload moderation data for multiple activities in a single query. Call this before loops to avoid N+1 queries.

Parameters:

  • $activity_ids (array) - Array of activity IDs

Returns: void

Example:

// Before activity loop
$activity_ids = wp_list_pluck( $activities, 'id' );
bmpro_cache()->batch_load_activity_moderation( $activity_ids );
// Now individual lookups are cached
foreach ( $activities as $activity ) {
$mod = bmpro_cache()->get_activity_moderation( $activity->id );
}

Clear cached data when moderation status changes.

Parameters:

  • $type (string) - Cache type: ‘activity_mod’, ‘member_flagged_meta’, ‘user_block’, etc.
  • $id (int) - Item ID to invalidate

Example:

// After updating moderation status
bmpro_cache()->invalidate( 'activity_mod', $activity_id );

Key Pattern Description
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
  1. Runtime Cache - In-memory array for current request (fastest)
  2. Object Cache - Uses wp_cache for persistent storage (works with Redis/Memcached)
  3. Database - Fallback when cache misses
// DO: Batch preload before loops
$ids = get_activity_ids_from_query();
bmpro_cache()->batch_load_activity_moderation( $ids );
// DON'T: Query individually in loops
foreach ( $activities as $activity ) {
// This causes N+1 queries without batch preload
$status = bmpro_is_activity_moderated( $activity->id );
}

Class Description
.bmpro-flag-activity-btn Activity flag button
.bmpro-unflag-activity-btn Activity unflag button
.bmpro-flag-member-btn Member flag button
.bmpro-flag-group-btn Group flag button
.bmpro-flag-message-btn Message flag button
.bmpro-flag-topic-btn Topic flag button
.bmpro-flag-reply-btn Reply flag button
Class Description
.bmpro-modal Modal container
.bmpro-modal-wrap Modal wrapper
.bmpro-modal-content Modal content area
.bmpro-modal-actions Action buttons container
.bmpro-modal-close-icon Close button
Class Description
.bmpro-loading Loading state
.bmpro-error Error message
.bmpro-successfull Success message
.bmpro-modal-overlay-active Body class when modal open

Last Updated: 2026-01-27 Plugin Version: 4.x+ WordPress: 6.0+ BuddyPress: 7.0+

See Also: