This section contains detailed articles elaborating on some of the common issues phpBB users encounter while using the product. Articles submitted by members of the community are checked for accuracy by the relevant phpBB Team. If you do not find the answer to your question here, we recommend looking through the Support Section as well as using the Site Wide Search.

How to change word censor behaviour to work with Code Tags

Description: This article describes how to change word censor behavior to work with BBCode [code] tags.

In Categories:

Link to this article: Select All
[url=https://www.phpbb.com/support/docs/en/3.0/kb/article/how-to-change-word-censor-behaviour-to-work-with-code-tags/]Knowledge Base - How to change word censor behaviour to work with Code Tags[/url]

Hi,
There are many topics on why the word censor does not work with code tags. This article will cover how to do it.

Tools needed:
FTP Client (like FileZilla), Text editor (like Notepad++)

Procedure:
First of all, you need to download the following file:
root/includes/bbcode.php
Before you begin editing it, you must make a backup of the file.

Open the file "bbcode.php" in a text editor.

Find: (Tip: Press F3 to start searching part of code which you are looking for.)

Code: Select all

         // Remove the uid from tags that have not been transformed into HTML
         if ($this->bbcode_uid)
         {
            $message = str_replace(':' . $this->bbcode_uid, '', $message);

After, add:

Code: Select all

            $message = censor_text($message);

After editing, that part of code should look like the following.

Code: Select all

         // Remove the uid from tags that have not been transformed into HTML
         if ($this->bbcode_uid)
         {
            $message = str_replace(':' . $this->bbcode_uid, '', $message);
            $message = censor_text($message);


Tested on phpBB v3.0.7-PL1
Thanks!