Integration Guide
Learn how to integrate BuddyPress Moderation Pro with your custom plugins, themes, and third-party services.
Adding Flag Button to Custom Content
Add moderation capabilities to your custom content type:
// Register custom content type for moderation
add_filter( 'bmpro_content_types', function( $types ) {
$types['my_custom_type'] = array(
'label' => __( 'My Custom Content', 'my-plugin' ),
'icon' => 'dashicons-admin-post',
);
return $types;
} );
// Display flag button
echo bmpro_get_flag_button( $content_id, 'my_custom_type' );
Custom Report Reasons
Add custom report reasons for your community:
add_filter( 'bmpro_report_reasons', function( $reasons ) {
$reasons['misinformation'] = __( 'Misinformation', 'my-plugin' );
$reasons['copyright'] = __( 'Copyright Violation', 'my-plugin' );
return $reasons;
} );
Custom Notifications
Send custom notifications when content is flagged:
add_action( 'bmpro_after_content_flagged', function( $content_id, $type, $user_id, $reason ) {
// Send Slack notification
wp_remote_post( SLACK_WEBHOOK_URL, array(
'body' => json_encode( array(
'text' => sprintf( 'Content flagged: %s (Type: %s)', $content_id, $type )
) )
) );
}, 10, 4 );
Theme Integration
Style the flag buttons in your theme:
/* Flag button styling */
.bmpro-flag-button {
background: #f0f0f0;
border: 1px solid #ddd;
padding: 5px 10px;
border-radius: 3px;
}
.bmpro-flag-button:hover {
background: #e0e0e0;
}
.bmpro-flag-button.flagged {
background: #ffebee;
border-color: #ef5350;
color: #c62828;
}
REST API Integration
Access moderation data via REST API:
// Get flagged content
GET /wp-json/bmpro/v1/reports
// Flag content
POST /wp-json/bmpro/v1/flag
{
"content_id": 123,
"content_type": "activity",
"reason": "spam"
}
