News:

Wondering if this will always be free?  See why free is better.

Main Menu

Disable censored words on one thread?

Started by Wellwisher, September 06, 2016, 02:41:25 PM

Previous topic - Next topic

Wellwisher

Hello SMF community and Devs,

I have an odd question, not sure if there is a easy way to do this:

Basically is it possible to disable the "censored words" on one thread?

I want something simple and easy, without having to hack away at SMF files and intergate, change large pieces of SMF code.

Illori

since it is not a default feature, it would require some code hacks no other way around it. also it would require overriding an user defined settings related to censoring words being on or off.

Pipke

The easiest way i can think of:

in Sources/Load.php

Code (find) Select

// Replace all vulgar words with respective proper words. (substring or whole words..)
function &censorText(&$text, $force = false)
{
global $modSettings, $options, $settings, $txt;
static $censor_vulgar = null, $censor_proper;


Code (replace with) Select

// Replace all vulgar words with respective proper words. (substring or whole words..)
function &censorText(&$text, $force = false)
{
global $modSettings, $options, $settings, $txt;
static $censor_vulgar = null, $censor_proper;

if ($_REQUEST['topic'] == 9)
return;


where 9 = topic id. So if you want to skip censor on topic 123, you have to replace the 9 to 123.

"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Pipke

cannot edit my above post, just found out my code generates an error in log.

it should be:

if (isset($_REQUEST['topic']))
{
if ($_REQUEST['topic'] == 9)
return;
}
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Wellwisher

Quote from: Pipke on September 07, 2016, 03:17:00 PM
cannot edit my above post, just found out my code generates an error in log.

it should be:

if (isset($_REQUEST['topic']))
{
if ($_REQUEST['topic'] == 9)
return;
}



@Pipke Just tried this clever snippet and it works beautifully, thank you mate! You could even turn this into a nifty little mod tbh.

Do I just use commas for multiple topics? Like:

if ($_REQUEST['topic'] == 9,10,11,128,1212) etc?

Shambles

@Wellwisher

You'd probably set up an array and check within that:


$topicList=array(9,10,11,128,1212);

if (in_array($_REQUEST['topic'],$topicList))

Advertisement: