Skip to content

Ralkage/flarum-ext-word-censor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word Censor

License: MIT

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:

  1. Guest? → Always censor
  2. Registered user with censoring enabled (default)? → Censor
  3. 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.

About

Configurable word censoring with per-user toggle. On by default for guests and registered users.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors