View Full Version : Disable swear filter for certain forums?
Nupraptor
10-29-2002, 10:45 PM
Does anyone think it would be possible to create a hack so as to disable the swear filter on just a few forums? By and large, we don't allow swearing at my board, but I would like to enable it for just a couple of forums. Is it possible? If so, could someone do this for me? :classic:
Logician
10-30-2002, 10:21 AM
in newthread.php, newreply.php, editpost.php find:
$subject=censortext($subject);
$message=censortext($message);
Replace it as:
if ($foruminfo[forumid]!=X AND $foruminfo[forumid]!=Y)
{
$subject=censortext($subject);
$message=censortext($message);
}
X and Y should be replaced with the forumids in which censor would not apply
Nupraptor
10-30-2002, 05:22 PM
Awesome! Thanks. :)
Would these settings carry over to sub-forums, or would I need to add each forumid?
Smoothie
10-30-2002, 05:45 PM
What if you wanted to have more than one forum included? And if it were just one forum, would x and y be the same number?
Logician
10-30-2002, 07:10 PM
Originally posted by Nupraptor
Would these settings carry over to sub-forums, or would I need to add each forumid?
You need to add each one's id seperately..
What if you wanted to have more than one forum included? And if it were just one forum, would x and y be the same number?
1 forum:
if ($foruminfo[forumid]!=X)
2 forums:
if ($foruminfo[forumid]!=X AND $foruminfo[forumid]!=Y)
3 forums:
if ($foruminfo[forumid]!=X AND $foruminfo[forumid]!=Y AND $foruminfo[forumid]!=Z)
4 Forums:
if ($foruminfo[forumid]!=X AND $foruminfo[forumid]!=Y AND $foruminfo[forumid]!=Z AND $foruminfo[forumid]!=W)
etc.
SWFans.net
10-30-2002, 08:11 PM
This modification works for the subject but not the message body. The swear filter is not implemented for the message subject (meaning the subject can contain words in the censoer list in the thread title) but the body text still gets censored. There is a missing piece here somewhere.
Logician
10-30-2002, 08:43 PM
Originally posted by SWFans.net
This modification works for the subject but not the message body. The swear filter is not implemented for the message subject (meaning the subject can contain words in the censoer list in the thread title) but the body text still gets censored. There is a missing piece here somewhere.
right..
here is the missing part:
edit functions.php, find:
global $regexcreated,$searcharray,$replacearray,$phpversi onnum;
REPLACE it AS:
global $regexcreated,$searcharray,$replacearray,$phpversi onnum, $thread;
find:
return censortext($bbcode);
Replace it as:
if ($thread['forumid']!=X AND $thread['forumid']!=Y)
{
return censortext($bbcode);
}
else{ return $bbcode;}
X,Y are forumids as usual..
SWFans.net
10-30-2002, 08:53 PM
Thank you, that works correctly. :)
SWFans.net
10-30-2002, 09:05 PM
Is there some kind of evaluation I can add to that section in functions.php that could test if it was a private message? As it is this modification allows censored text in Private Message body text but not titles.
Logician
10-30-2002, 09:38 PM
yep.. put a variable like "$my_priv_variable=1;" in private message related scripts right before it calls the function bbcodeparse2 and use the same method: Add the variable to the global line of the function and return result accordingly like:
if ($my_priv_variable!=1)
{
return censortext($bbcode);
}
else{ return $bbcode;}
Of course if you want to cancel it in both private messages and some forums, you need to combine 2 lines:
if ($thread['forumid']!=X AND $thread['forumid']!=Y AND $my_priv_variable!=1)
{
return censortext($bbcode);
}
else{ return $bbcode;}
SWFans.net
10-30-2002, 09:41 PM
Thanks for all your help. :)
I will test this all soon and let you know how it works for us.
SWFans.net
10-31-2002, 04:09 AM
I tested that and it didn't work out, but I found something that did since you helped me find the code in private.php. :)
I heavily modified all of this so it would be a setting controllable from the admin CP when editing or adding forums, and so there were no bugs in post or topic titles when editing replying or posting a new thread, as well as applying it to the edit reason hack I have on our forums from Firefly's assortment of hacks available. It all works great and I have you to thank Logician, because you led this lost hacker to all the right places.
Thanks!
:)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.