ralkage / flarum-ext-word-censor
Configurable word censoring with per-user toggle. On by default for guests and registered users.
Package info
github.com/Ralkage/flarum-ext-word-censor
Type:flarum-extension
pkg:composer/ralkage/flarum-ext-word-censor
Requires
- flarum/core: ^2.0.0-beta
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2026-03-22 00:23:07 UTC
README
Configurable word censoring extension for Flarum with a per-user toggle. Censoring is on by default for all users, including guests.
Features
- Admin-defined word list — Add words or phrases to censor, one per line
- Configurable replacement character — Choose what character replaces censored letters (default:
*) - Always on for guests — Unauthenticated visitors always see censored content
- Per-user toggle — Registered users can disable censoring from their account settings
- Display-time only — Original post content is preserved in the database; censoring is applied at render time
- HTML-safe — Only censors visible text, leaving HTML tags and attributes intact
How It Works
When a post is serialized for the API response, the extension checks:
- Guest? → Always censor
- Registered user with censoring enabled (default)? → Censor
- Registered user who disabled censoring? → Show original content
Censored words are matched using word boundaries to avoid false positives (e.g., "ass" won't match "assistant"). Matching is case-insensitive.
Example
Word list:
damn
crap
Original post: This is a damn good example
Censored view: This is a **** good example
Installation
composer require ralkage/flarum-ext-word-censor php flarum cache:clear
Enable the extension in the admin panel under Extensions > Word Censor.
Configuration
Admin Settings
Navigate to the Word Censor extension settings page:
| Setting | Description |
|---|---|
| Censored Words | One word or phrase per line. These will be replaced when displayed. |
| Replacement Character | Character used to replace each letter of a censored word. Default: * |
User Settings
Registered users can toggle censoring on/off from Settings in their account page. The toggle is labeled "Enable Word Censoring".
Requirements
- Flarum
^1.8 - PHP 8.0+
Links
License
MIT License. See LICENSE for details.