The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Replacing certain censored words with other words, rather than *'s
Hello, everyone! I have been having a bit of a problem, but I think somebody will be able to help me out!
At my forum, I want to have the following filters: liberal = Capulet liberals = Capulets conservative = Montague conservatives = Montagues First, I put liberal, liberals, conservative, and conservatives in the vB censorship box. Then I tried to accomplish my goal by putting the following code in functions.php in the censorship code: $text = strtolower($text); if ($text == 'liberals') { $text = 'Capulets'; } else if ($text == 'liberal') { $text = 'Capulet'; } else if ($text == 'conservatives') { $text = 'Montagues'; } else if ($text == 'conservative') { $text = 'Montague'; } It works only if the offending word is the ONLY word in the post. If there is anything else, it simply converts the word to asterisks. Anybody have any suggestions? |
#2
|
||||
|
||||
Quote:
but without getting complicated you can use replacements, but this will effect the whole site. |
#3
|
||||
|
||||
I applaud your taste in replacements.
|
#4
|
||||
|
||||
Is there a reason why you can't just add those as replacement variables?
|
#5
|
||||
|
||||
Quote:
|
#6
|
|||
|
|||
Modest Proposal For Replacement Text for vBulletin
One approach to offering text replacement in posts, and other user inputs, would be to change the specification for the censored word list in the AdminCP. Right now, one can specify two types of censored word matching: foo matches any occurrence of the 3 characters, words or otherwise {foo} matches any occurrence of the word "foo"; anywhere it finds the 3 characters not preceded and followed by a letter. Matches 3 times in this text: Foo is 3foo or _foo Extending This Implementation (= syntax) A fairly localized hack could extend this so that AdminCP censored word could include replacement text. An admin could specify these new types in the list of censored words: {Conservative}=Montague Replace any occurrence of the first word with the second word. {/home}=www.mydomain.com Provides an abbreviation for the word match "/home". This would be a fairly simple hack, although I would suggest that one would not want to apply the replacer specifications to text inside of [CODE], [PHP], etc. The other caveat would be that the replacement text may not contain any HTML-special characters. |
#7
|
||||
|
||||
well he could modify the censor text function to change those certain words to a desired word
|
#8
|
|||
|
|||
AaronJH,
Please see: Process post text replacements, abbreviations, fake BBCODE's To do what you want to do, you can add the following to your AdminCP :: vBulletin Options :: Censorship Options: {conservative}==montague {liberal}==capulet The mod (the '==' operator) will take care of matching case for these words, for example, "Conservative" will be translated to "Montague" and "CONSERVATIVE" will be translated to "MONTAGUE". -------------------------- This post was originally where I posted the mod. I thought it would be better to post it properly, so I removed all the duplicate text here. BTW, the attached version in the above linked post was modified ever so slightly from the one posted last night. It now allows "=" (equals) in replacement text, which allows one to define fake bbcodes, a la: {[h1]}=[size=4][color=navy][i] which would process [h1] bbcodes found in user input and turn them into big, coloured, italicised text. |
#9
|
|||
|
|||
Oh yes, I should have mentioned that this can also be used to remove words or strings rather than replace them with *'s. One would use this syntax to remove a string or a word:
anychars= {word}= One simply does not specify a replacement -- the '=' is followed by a space. |
#10
|
|||
|
|||
Thanks for the hack!
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|