View Full Version : User-Selectable Optional Language Replacement Censor
User-Selectable Optional Language Replacement Censor by 006
What this hack does:
This will give your users the option whether or not they want to have certain words censored or not. Also instead of the standard *** for censored words, this lets you substitute different words that will be used to replace words.
For example, if the user has language filter turned on, and the word "dog" is censored, and you have chosen to have the word "cat" be used as a replacement, then this user will see the word "cat" in every post where the word "dog" is used. If the user does not choose to enable censoring, they will see the word "dog."
(No use censoring that word lol, it's just for the example) ;)
Benefits of this hack:
People will no longer try to cheat to get their words in by typing "" in the middle of certain censored words to fool the word filter. If they want to see all words, they choose to not use the censor and are happy. If they are offended by certain words, they can use the censor and be happy. Everybody wins. :pirate:
User-Selectable Optional Language Replacement Censor
by 006
INSTALLATION TIME:
About 20 - 30 minutes. (6 steps, 4 file edits, 3 template edits, and 1 query)
It has been tested and works fine in 2.2.9
Any questions? Feel free to ask in this thread. ;)
If you use this hack, please click "INSTALL (https://vborg.vbsupport.ru/misc.php?s=&action=install&threadid=53640)." Thanks
:)
Updated install file to .php so it doesn't parse replacements.
Oh this is so useful... some of my members are offended by the words i censored and some don't care and want to see them so great hack and I'll install it in a few.
/me clicks install
Cool. Let me know how it goes for you.
:)
assassingod
05-31-2003, 05:17 PM
Very cool;) I'll install this on locally later
Cool. I just updated the installation file so censoring is turned on by default for guests.
The only change is in functions.php
Change if ($bbuserinfo[usecensor]!=0)
toif ($bbuserinfo[usecensor]!=0 or $bbuserinfo[userid]==0)
Koutaru
05-31-2003, 05:35 PM
this is excellent :) thanks 006 -- I'll check it out when I get home
Chris M
05-31-2003, 06:05 PM
Nice idea:)
Satan
Thanks. Let me know how it goes everyone. :)
Chris M
05-31-2003, 06:11 PM
Ok a quick question:
admin/functions.php, we are told to add:
// User-Selectable Optional Language Replacement Censor by 006
if ($bbuserinfo[usecensor]!=0 or $bbuserinfo[userid]==0) {
$bbcode=eregi_replace("wordtocensor","replacewith", $bbcode);
$bbcode=eregi_replace("wordtocensor","replacewith", $bbcode);
} else {}
// User-Selectable Optional Language Replacement Censor by 006
But there is nothing in the "} else {" statement...
Also :
registeradult template:
<tr>
<td bgcolor="{firstaltcolor}"><normalfont><b>Pop up a box when you receive a Private Message?</b></normalfont><br>
<smallfont>This will pop up a small warning box when you receive a Private Message asking whether you want to view the message.</smallfont></td>
<td bgcolor="{firstaltcolor}"><normalfont>
<input type="radio" name="pmpopup" value="yes"> yes
<input type="radio" name="pmpopup" value="no" checked> no
</normalfont></td>
</tr>
-----------------------FIND-------------------------------------
and underneath it, add
---------------------------------ADD----------------------------
<tr>
<td bgcolor="{secondaltcolor}"><normalfont><b>Pop up a box when you receive a Private Message?</b></normalfont><br>
<smallfont>This will pop up a small warning box when you receive a Private Message asking whether you want to view the message.</smallfont></td>
<td bgcolor="{secondaltcolor}"><normalfont>
<input type="radio" name="usecensor" value="yes" checked> yes
<input type="radio" name="usecensor" value="no"> no
</normalfont></td>
</tr>
Forgot to change something?:D
Satan
MY BAD! (Will change that now) :)
and..
There's not supposed to be. That just leaves censoring totally off for people who selected to turn it off.
Chris M
05-31-2003, 06:17 PM
Well surely you would just have:
// User-Selectable Optional Language Replacement Censor by 006
if ($bbuserinfo[usecensor]!=0 or $bbuserinfo[userid]==0) {
$bbcode=eregi_replace("wordtocensor","replacewith", $bbcode);
$bbcode=eregi_replace("wordtocensor","replacewith", $bbcode);
}
// User-Selectable Optional Language Replacement Censor by 006
I have a few suggestions for the next version if I may?:)
List of censored words
User can add their own words
OR
List of censored words
User can suggest words to be censored
:)
Satan
Fixed. I also noticed that vb.org was parsing the replacement values, so I changed the install file to .php.
To answer your question before. The else isn't really necessary... (edited. I took it out. My bad!) :)
Chris M
05-31-2003, 06:21 PM
Ok, but IMO having an }else{ statement for nothing seems wasted;)
Luckily, in the .txt file I downloaded, the replacements were OK, it was just because I copied them from the .txt file into my post;):)
Satan
I took it out now. I originally had something in there but decided it wasn't needed. I see what you meant. lol
*Wonders what he was thinking*
Today at 02:17 PM hellsatan said this in Post #11 (https://vborg.vbsupport.ru/showthread.php?postid=402467#post402467)
I have a few suggestions for the next version if I may?:)...
As much as I hate to hardcode variables it was my only choice because I don't know any other way to do it. If you want to do that feel free and PM me and I will update the install file.
You'd get credit of course. :)
Chris M
05-31-2003, 06:29 PM
Not to be a pest, but you made another typo;)
in registeradult:
<normalfont><b>se language filter?</b></normalfont>
=
<normalfont><b>Use language filter?</b></normalfont>
:)
Satan
Chris M
05-31-2003, 06:30 PM
Today at 08:28 PM 006 said this in Post #15 (https://vborg.vbsupport.ru/showthread.php?postid=402473#post402473)
As much as I hate to hardcode variables it was my only choice because I don't know any other way to do it. If you want to do that feel free and PM me and I will update the install file.
You'd get credit of course. :)
Ok sure:) I'll have a tamper around and see what I can come up with:)
Satan
Fixed the typo.. lol
You're killing me man.. j/k lol :)
Thanks! :p
Chris M
05-31-2003, 06:49 PM
It works very well:)
Maybe thread titles could do with it as well;)
And i'm working on the list thing;):)
Satan
Today at 02:49 PM hellsatan said this in Post #19 (https://vborg.vbsupport.ru/showthread.php?postid=402481#post402481)
Maybe thread titles could do with it as well;)
Satan
I see what you mean.. Which file are thread titles censored? I' sure there is a way to make this also work with the standard censoring feature to, but for now you just have to turn it off...
I will look into that. Good idea.
Chris M
05-31-2003, 08:09 PM
I think they are censored in forumdisplay.php and showthread.php:)
Satan
I looked in both of those earlier today with no luck.
Koutaru
06-01-2003, 04:58 AM
i believe
$subject=censortext($subject);
in editpost, newthread, newreply
;) then again I may be wrong
Mine didn't have that... I'll look again tomorrow. It's late. :)
Chris M
06-01-2003, 10:23 AM
Aha -
In newreply.php:
$title=censortext($title);
$message=censortext($message);
// sort attachement
In newthread.php:
$subject=censortext($subject);
$message=censortext($message);
// remove all caps subjects
In editpost.php:
$title=censortext($title);
$message=censortext($message);
// remove all caps subjects
:)
Satan
Tony G
06-01-2003, 10:26 AM
Convienient mod, thanks for this. May just use. :)
Mike11212
06-01-2003, 06:38 PM
question does the word filter in the admin cp have to be enabled or disabled for this to work correctly?
Well I just updated the install file now.
Changed step 6. With the update, you DO (yes) need to have censoring enabled in admincp.
Thread titles will now be censored as well, but will be censored regardless of the users preferences. If anyone knows how to use the replacement system for the thread titles based on if the user has selected to use censoring or not please let me know.
Thanks.
If you don't see a different step 6 then clear your cache and then try downloading again.
:)
Chris M
06-01-2003, 08:40 PM
Quick Q:
Which step 6?
The first one, second one or third one?;):p
Satan
Everything in step 6 is new. :)
The old step 6 was just disabling the censor option from admincp... but now you need it enabled, at least if you use the new step 6.
~006 :)
Chris M
06-02-2003, 07:12 PM
I will wait and see if a way is found to do it via your method for titles - If one is not found, I will see if I can find some way to make it do it:)
Satan
Cool. And I just found out that the censoring option needs to be turned OFF in your admin CP for this hack to work.
I am still trying to get this to work with titles... I found some censoring code in the functions.php a few scrolls under the edit this hack makes that I am looking into..
Chris M
06-03-2003, 09:10 AM
Okies cool;)
Satan
Andrew111888
06-05-2003, 07:59 PM
Umm.... everytime I try to click "Yes" to use language filter in my user cp and click edit options, it's set to No again?
Some help!
Andrew111888
06-05-2003, 11:33 PM
Anybody?
Andrew111888
06-06-2003, 09:50 PM
??????????????
Andrew111888
06-07-2003, 01:01 AM
Okay, I do everything I'm told to do. I have the filter in the admin cp set to off. I go to user CP and turn my filter on. I then re-enter my user cp options, and it's set to "no" again. I.E.: The filter doesn't stay on. My other users have noticed this too.
Any ideas?
Andrew111888
06-07-2003, 02:55 PM
Jeez, within 11 hours a thread is bumpped back to halfway down on the second page...
Sounds like you may have missed a step in member.php
There are defining variables that determine whether or not the Yes or No radio buttons will be checked or not.
Try going back and making sure you did everything. It should definately work if you followed all of the directions.
You did run the query right?
Can you edit a users options in the admin cp? Does your selection stay there? If so then go back and redo the edits in member.php.
Andrew111888
06-07-2003, 09:32 PM
I just double checked; I did have something incorrect that I fixed, then double checked again and all seems to be in order.. but it still won't stay checked yes.
I would suggest reverting all the edits back to how they were before hacking and trying again. (Reversing the query won't do anything so you can leave that how it is with the new userfield and all).
If you run into any code that you aren't sure about post it and I will help you out. :)
Hope all goes well.
Andrew111888
06-08-2003, 04:49 PM
I just took half an hour to re-install this and IT STILL DOESN'T KEEP "YES" SELECTED!!
Ok check Step 3.
Also, check the modifyoptions template edit in Step 6.
Make sure you have the $usecensornotchecked and $usecensorchecked variables in there as well in the modifyoptions edit or the buttons will not be checked.
Also, if you tried to make the code in Step 6 in it's own seperate template it will not work. I tried this before too and everything else was the same and it didn't work. It displayed the option field but yes or no was not selected.
Did you do anything different at all with the hack?
Andrew111888
06-08-2003, 06:24 PM
I have it all fine:(
I really don't know then. The only thing I can say is if you want I can go check out your code. I don't see any other way to do it.
I don't see why it's not working for you but I would have to see your code to find the problems. Maybe PM me about it or something.
Pikok
07-13-2003, 04:43 AM
I had the same problem with the filter getting turned off and not working. There's an error in the code in the installation file..
In "root/member.php" where it says to add:
// User-Selectable Optional Language Censor by 006
$swearfilter=iif($swearfilter=="yes",1,0);
Under:
$options+=iif($showimages=="yes",4,0);
Add This Instead:
// User-Selectable Optional Language Censor by 006
$usecensor=iif($usecensor=="yes",1,0);
Basically, if you've already installed this hack.. Just replace both instances of "swearfilter" with "usecensor" in that line and you should be all set. ;)
Andrew111888
07-13-2003, 04:59 AM
Pikor, you are a LIFE saver!
Pikok
07-13-2003, 05:15 AM
No problem.. Happy to help. ;)
Pikok
07-13-2003, 05:52 AM
Okay, I have a question..
Anybody have a suggestion on how to filter for example "crap", but not "scrap" with this hack? I know I could check for " crap", "crap ", and " crap ".. But, then if "crap" was the only word on a line it wouldn't get filtered. I can only figure out how to get it to filter the word if there's other text on the line with it.
Another idea would be to be able to add a list of words that would be ignored as well as words to be filtered. If this could be done, it would be less work and probably give better performance as there would only be the 2 lines vs. the 4+ lines.
I'm not quite sure how to do it with this hack. Any ideas?!? :confused:
Great hack here, it is installed.
One question, how do I disable this for guest users and people not logged in?
Thanks.
Pikok I tried doing somethng similar to that but to no avail. Also thanks for pointing out the error in the file. I changed the name at the last minute and guess I missed a few. Install file was updated a while ago. Just got around to posting now. Haven't had a lot of time for a while.
fareastbuddy
02-03-2004, 10:00 PM
Great hack...
So has anyone been able to censor the thread/post titles? Also, I'm also having problems with the censor being turned off. Everytime I update my profile and click Submit, the censor turns off and I have to turn it back on.
Bison
03-30-2004, 06:51 AM
This hack would be even better if you can also do this through the Admin CP. I was just looking for something like this ... just for the Admin CP. I rather have this to work for just the Admins, since some members like the flame the board with curse words and profanity.
Instead of allowing them to express themselves with these curse words, change the word to something otherwise that the four-letter word.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.