comment_moderation_ai
A comprehensive module that currently integrates OpenAI's latest Omni moderation API with advanced custom policies, enhanced Views integration, and sophisticated status management to automatically validate and flag inappropriate comments based on configurable rules.
Features
Latest OpenAI Omni Models Integration: Integration with OpenAI's newest omni-moderation-latest model for superior accuracy and multimodal support. Enable/disable specific OpenAI moderation categories (hate speech, harassment, violence, etc.)
Intelligent Status Management: Risk-based automatic status assignment (high/medium/low priority) based on confidence scores with comprehensive workflow statuses including auto_flagged_high, auto_flagged_medium, flagged_low_risk, and pending_review.
Advanced Custom Policies: Beyond OpenAI moderation, includes keyword filtering, length restrictions, rate limiting, competitor detection, marketing content identification, and PII protection (emails, phones, SSNs, credit cards, addresses).
Enhanced Views Integration: Seamless integration with Drupal's /admin/content/comment/approval view featuring color-coded status badges, priority indicators, advanced filtering options, and visual flagged/clean indicators.
Post-moderation Capabilities: Allow community members to flag published comments with escalation workflows and comprehensive audit trails for all moderation decisions.
Post-Installation
After installation, navigate to Configuration → OpenAI Comment Moderation (/admin/config/comment-moderation-ai) to configure the module:
- OpenAI API Setup: Enter your OpenAI API key and select your preferred moderation model (omni-moderation-latest recommended). Use the built-in connection test to verify your API setup.
- Core Moderation Settings: Enable moderation, configure auto-flagging and auto-unpublishing behaviors, and set sensitivity thresholds (0.0 to 1.0).
- OpenAI Categories: Enable/disable specific moderation categories like hate speech, harassment, self-harm, sexual content, and violence.
- Custom Policies: Configure additional rules including keyword filtering, length restrictions, rate limiting, competitor detection, marketing content blocking, and PII protection.
- Permissions: Set up user permissions at
/admin/people/permissionsfor viewing flagged comments, moderating content, and bypassing moderation checks.
Once configured, the module automatically moderates new comments and enhances your existing comment approval workflow at /admin/content/comment/approval with visual status indicators and advanced filtering options.
Additional Requirements
- OpenAI API Key: Required for AI-powered moderation features. Sign up at OpenAI Platform
- PHP 8.3+: Required for optimal performance with regex operations and modern PHP features
- PHP cURL Extension: Essential for API communication with OpenAI services
- Comment Module: Must be enabled (Drupal core dependency)
- Key Module: For secure API key storage and management
The module integrates with Drupal's core comment system and requires no additional external libraries beyond the OpenAI API access.
Recommended modules/libraries
- Devel: Helpful for debugging moderation workflows and testing custom policies during development
- Admin Toolbar: Provides quick access to moderation configuration and flagged comments management
- Views Bulk Operations: Enhances bulk moderation actions for processing multiple flagged comments efficiently
- Mailsystem: Improves email notification formatting for moderation alerts and flag notifications
- Token: Enables dynamic token replacement in notification emails and moderation messages
What differentiates this module is its integration with OpenAI's latest Omni models, comprehensive custom policy engine, intelligent risk-based status management, and seamless Views integration for efficient moderation workflows.
Community Documentation
- Comprehensive README: Detailed documentation included with the module covering all features, configuration options, and troubleshooting guides
- API Documentation: Inline code documentation for developers wanting to extend or integrate with the module