1
0
antisocial-safety/readme.md
2024-10-10 17:10:14 +00:00

51 lines
2.1 KiB
Markdown

# openai moderation for attachments and comments
running a small website can be a hassle when idiots upload nasty stuff or spam your comments. this plugin uses openai's moderation api to automatically check images and comments for bad content.
## why use this plugin?
it keeps your site clean by blocking offensive or illegal images and comments before they become a problem. saves you headaches.
## features
- **attachment moderation**: images are checked during upload. flagged images are blocked from being accessed.
- **comment moderation**: comments are reviewed before they're saved. flagged comments are set to unapproved.
- **admin integration**: see moderation status directly in your media library and comments list. detailed info available in edit screens.
- **easy setup**: just add your openai api key in the settings.
## installation
1. upload the plugin files to `/wp-content/plugins/`, or install through the wordpress plugins screen.
2. activate the plugin.
3. go to `settings` > `openai moderation` and enter your openai api key.
## how it works
### attachment moderation
- when an image is uploaded, the plugin sends it to openai's moderation api using the `omni-moderation-latest` model.
- if the image is flagged, the plugin blocks access to it by sending a 403 forbidden response when someone tries to view it.
### comment moderation
- before a comment is saved, the plugin checks the content with openai's moderation api.
- flagged comments are set to unapproved, so they won't show up on your site unless you approve them.
### backend functionality
- hooks into `add_attachment` to moderate images upon upload.
- uses `template_redirect` to block access to flagged attachments.
- hooks into `preprocess_comment` and `pre_comment_approved` to moderate comments before saving.
- stores moderation results in post and comment meta.
- adds custom columns in admin screens to display moderation status.
- provides detailed moderation info in the attachment and comment edit screens.
## requirements
- wordpress 5.0 or higher
- an openai api key
## notes
- if the openai api key isn't set, the plugin won't function.