Skip to content

PHP API

Reference for the public functions, data structures, and integration points in BuddyPress Moderation Pro. Signatures are taken from the plugin source.

Returns the moderation status options used to filter the queue.

// array(
// 'awaiting_moderation' => 'Pending',
// 'spam' => 'Spam',
// )

Filter: bmpro_spam_statuses_types.

Returns the settings tabs added after Welcome and General.

// array(
// 'restrictions' => 'Restrictions',
// 'profile_avatar' => 'Avatar Moderation',
// 'reported-keyword' => 'Categorize By Report',
// )

Filter: bmpro_content_to_flag.

Returns the auto-moderation report threshold as an integer. Reads auto_mod_limit from the bmpro_restrictions option and defaults to 5.

Filter: bmpro_auto_mod_limit_filter (passed the limit and the settings array).

bmpro_auto_moderation_enable( $component )

Section titled “bmpro_auto_moderation_enable( $component )”

Returns whether auto-moderation is enabled for the given component (activity, comment, member, group, and so on).

Filter: bmpro_auto_moderation_enable.

Returns who loses sight of reported content, either 'reporters' or 'all_users'.

Filter: bmpro_get_moderation_mode_filter.

Returns whether the user (current user when 0) may report content, based on the roles allowed on the General tab.

Filter: bmpro_user_can_report.

Returns the WP_User objects for a role.

Filter: bpmp_get_users.

Returns the configured notification recipient IDs for $role (for example admin or moderator), read from the bmpro_gen_stngs option.

Filter: bpmp_moderator_users.

Returns the count of pending reports, used for the admin menu badge.

Filter: bmpro_count_reporters_filter.

  • bmpro_spam - Each reported content item. Uses the bmpro_spam / bmpro_spams capability type and is shown under the Moderation menu.
  • bmpro_avatar_spam - Each pending avatar submission. Shown under the Avatar Mods menu.
  • bmpro_content_type - Taxonomy on bmpro_spam that records the content type of each report (activity, comment, member, group, message, topic, reply).

Front-end actions are dispatched through admin-ajax.php. The public script is localized as bmpro_ajax_object, and every request is verified with check_ajax_referer( 'bmpro_ajax_security', 'ajax_nonce' ).

Flag and unflag handlers exist per content type, for example bmpro_flag_activity_function / bmpro_unflag_activity_function, with equivalents for comment, member, group, message, topic, and reply. Moderation actions include bmpro_spam_hide_function, bmpro_spam_delete_function, bmpro_spam_cleanup_function, bmpro_spam_author_punish_function, bmpro_spam_member_lock_function, and the avatar bmpro_approve_avatar_function / bmpro_reject_avatar_function.

The plugin does not register its own REST routes. It hooks bp_rest_activity_prepare_value (via bmpro_data_embed_rest_api) to embed moderation data in the BuddyPress activity REST response.

The bmpro command provides:

  • wp bmpro status - Current moderation configuration and counts.
  • wp bmpro stats - Report statistics.
  • wp bmpro cleanup - Clean up reported content.