Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
User Optional Word Censorship Details »
User Optional Word Censorship
Mod Version: 1.00, by MrEyes (Contributor) MrEyes is offline
Developer Last Online: May 2017 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.7.0 RC 3 Rating: (1 vote - 5.00 average) Installs: 21
Released: 18 Apr 2008 Last Update: Never Downloads: 7
Not Supported Code Changes Re-usable Code Translations  

User Optional Word Censorship

What this hack does

The default censorship options in VB are all or nothing, in other words it is either enabled or disabled for all users regardless of their personal preference. Without any additional SQL calls and an extremely low runtime impact (on top of the resource usage required when using the censor in the first place), this hack gives the user the option to view your forum with the AdminCP configured censor switched on if you have it enabled.

How to install

In summary the install requires:
  • Around 2 minutes.
  • 1 file change.
  • The addition of a custom user profile field.
  • A basic understanding of PHP.

So this is what you need to do:

First create a custom user profile field:
  1. Log in to your AdminCP.
  2. Goto "User Profile Fields -> Add New User Profile Field"
  3. In "Profile Field Type" select "Multiple-Selection Checkbox" and then click "Continue"
  4. In "Title" enter "Enable word censor" *
  5. In "Description" enter "If you choose to enabled this option all words on the current censor list will be replaced with * characters" *
  6. In "Options" enter "Enable censor" *
  7. Set "Private Field" to "Yes"
  8. Set "Field Searchable on Members List" to "No"
  9. Set "Show on Members List" to "No"
  10. Set "Display Page -> Which page displays this option?" to "Options: Other"
  11. Click "Save", this will then take you to a page that summarises all current profile fields.
  12. On this profile fields list find the one you just added and take note of the "Name" value. Typically this will be somthing like "Field5".

* These options set the text that is displayed to the user, feel free to customise/change these to whatever you want.

All the AdminCP work is done now, so if you want logout. The next step is to make a small file edit, to check this field value when VB calls the censor code.
  1. Take a backup of "includes\functions.php" just incase something goes horribly wrong.
  2. Open the "includes\functions.php" file in your favourite text editor.
  3. Find the following lines (typically these are around line 545):


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  4. Immediately after the lines above (i.e. after the {) add the following code:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

    You should end up with something that looks like this:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  5. Now this is probably the most complicated part of this simple install. Remember when you setup the profile field and you took a note of the "Name" value? Well in the text you just pasted into the function.php file you need to change this:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

    To match the name of the field, so for example if your field name is "Field12", it would look like this:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

  6. Save the file, and upload to your server.

The last, and most critically important step is:
  1. Click Install
All done, sit back and relax

Footnotes

By default the censor will be off for all users, so they will have to change their profile in order to enabled this. I could not find a way to create a profile checkbox field that is checked by default, and describing how to run SQL scripts to set the field value is more complicated than I wanted to go with this simple hack. So if anybody knows how to do this post the details and I will update the article. In the meantime a simpler option (rather than playing with the DB) is to use "Yes" / "No" radio buttons and set the default value to Yes (or no if you prefer). If you do this you will also have to subtly change the code above from:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

to:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
User-optional Replacements-based Censorship tjdrico vBulletin 3.0 Full Releases 70 04 Nov 2007 13:10

Comments
  #2  
Old 18 Apr 2008, 17:27
MrEyes MrEyes is offline
 
Join Date: Nov 2004
Because you just never know
Reply With Quote
  #3  
Old 18 Apr 2008, 19:41
youradhere4222 youradhere4222 is offline
 
Join Date: Sep 2007
I've been wanting this! Thanks!
Reply With Quote
  #4  
Old 18 Apr 2008, 22:30
iogames's Avatar
iogames iogames is offline
 
Join Date: Jan 2007
Real name: Josh Arcadia
Nominated!
although I'm in favor of free speech
__________________
. █│║▌│█│║▌║│█║▌│║║█║
Reply With Quote
  #5  
Old 18 Apr 2008, 23:27
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
 
Join Date: Jan 2002
Real name: Wayne
Even without queries, parsing the post every display can really rack up resource usage. Formatting and displaying the post is more intensive than pulling it from the database. How do you work around this?
__________________
Wayne Luke
Get started with your own social network. Purchase and download vBulletin today.
Reply With Quote
  #6  
Old 19 Apr 2008, 00:12
MrEyes MrEyes is offline
 
Join Date: Nov 2004
Originally Posted by Wayne Luke View Post
Even without queries, parsing the post every display can really rack up resource usage. Formatting and displaying the post is more intensive than pulling it from the database. How do you work around this?
Yes, running with the vBulletin word censor enabled will of course increase usage. However this isn't an issue for me as this modification doesn't alter the default vBulletin parsing system.
Reply With Quote
  #7  
Old 19 Apr 2008, 13:55
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
 
Join Date: Jan 2002
Real name: Wayne
Yeah, but it prevents you from using the postcache which is created on edit of the post and stores the post in its parsed state to be shown on the screen without running BBCode and censor parsing at runtime.
__________________
Wayne Luke
Get started with your own social network. Purchase and download vBulletin today.
Reply With Quote
  #8  
Old 19 Apr 2008, 17:53
MrEyes MrEyes is offline
 
Join Date: Nov 2004
In which case take the issue up your VB development team as the issue you have is with default VB code/architecture and is most certainly beyond the scope of this 2 minute hack.

Last edited by MrEyes; 19 Apr 2008 at 18:24.
Reply With Quote
  #9  
Old 03 Jun 2008, 00:57
ZombieAndy's Avatar
ZombieAndy ZombieAndy is offline
 
Join Date: Oct 2004
Real name: Andy
Dosn't work, just makes the screen go white and nothing else.

This is my code, i might of missed something obvious..


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
My Forums - A Forum dedicated to the horror films comprising the George A. Romero "Dead" series of films, Night of the Living Dead, Dawn of the Dead, Day of the Dead, Land of the Dead, Diary of the Dead and Survival of the Dead.
Reply With Quote
  #10  
Old 05 Jun 2008, 21:18
ZombieAndy's Avatar
ZombieAndy ZombieAndy is offline
 
Join Date: Oct 2004
Real name: Andy
Anyone?
Reply With Quote
  #11  
Old 06 Jun 2008, 03:32
TheFallenAngel TheFallenAngel is offline
 
Join Date: Dec 2004
Originally Posted by ZombieAndy View Post
Dosn't work, just makes the screen go white and nothing else.

This is my code, i might of missed something obvious..


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Remove the second

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #12  
Old 06 Jun 2008, 15:20
ZombieAndy's Avatar
ZombieAndy ZombieAndy is offline
 
Join Date: Oct 2004
Real name: Andy
D'uh! I knew it would be something simple!

Thanks man!
Reply With Quote
  #13  
Old 10 Sep 2008, 20:10
VikesRule VikesRule is offline
 
Join Date: Aug 2008
Does this code mess up with editing posts and whatnot and does it take a while to load?
Reply With Quote
  #14  
Old 18 Nov 2008, 20:05
JackThomson120 JackThomson120 is offline
 
Join Date: Jul 2007
Theres one problem, when the post is submitted, it censors the words and puts them in the database censored. So if this is turned off, they will display uncensored for all users.
Reply With Quote
  #15  
Old 03 Dec 2008, 00:04
Brittany Brittany is offline
 
Join Date: Jul 2008
OK I installed this exactly how you said and when I go to disable the censor
it says

"A required field called Enable word censor is missing or has an invalid value."

What am I doing wrong?


eta:
My code


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by Brittany; 03 Dec 2008 at 18:58.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 01:14.

Layout Options | Width: Wide Color: