View Full Version : Staff can view censored words in postbit
Max Taxable
06-13-2014, 03:25 AM
I have a friend who admins a large v4.2.1 board and he wants himself and his staff to be able to see the censored words in postbit instead of the asterisks.
Offhand I can see this being a usergroup permission thing perhaps?
Anyone with any thoughts on this?
My first thought is that I believe the censoring feature replaces the word with asterisks before it's saved in the database, so that you'd need to change how that works. Or maybe you could use a hook before the censoring to find the words and log them to a different table, then use that data somehow when a staff member displays a post.
Max Taxable
06-13-2014, 02:10 PM
My first thought is that I believe the censoring feature replaces the word with asterisks before it's saved in the database, so that you'd need to change how that works. Or maybe you could use a hook before the censoring to find the words and log them to a different table, then use that data somehow when a staff member displays a post.I was thinking something like this, were this a vB 3.8.
includes/functions.php find:
function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ;
Replace with:
function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ,$bbuserinfo;
if(($bbuserinfo[usergroupid] == 5) or ($bbuserinfo[usergroupid] == 6) or ($bbuserinfo[usergroupid] == 7)){
$enablecensor = 0;
}
Then find
$bbcode=str_replace("{", "{", $bbcode); // stop people posting replacements in their posts
return censortext($bbcode);
Replace with:
$bbcode=str_replace("{", "{", $bbcode); // stop people posting replacements in their posts
return $bbcode;
But I have no idea the version 4 use of this.
I don't find any function called censortext() in vb3.8.8. Maybe it's an older version that works differently? I see a function called fetch_censored_text(), but if you added a check of bbuserinfo[userid] I believe you'd be checking the usergroup of the user who was posting, since it's called when the post is saved and not every time it's viewed.
Max Taxable
06-13-2014, 09:27 PM
I don't find any function called censortext() in vb3.8.8. Maybe it's an older version that works differently? I see a function called fetch_censored_text(), but if you added a check of bbuserinfo[userid] I believe you'd be checking the usergroup of the user who was posting, since it's called when the post is saved and not every time it's viewed.Yes I hadn't thought of that. That check would merely allow those usergroups to not have to pass the censor.
Any way you can think of, for the staff of a board to be able to see what was actually typed and not the asterisks?
tbworld
06-14-2014, 12:39 AM
I looked at at the vb4 code since I kind of liked @kh99's idea and I knew he was on the right track. I was hoping in the post table "pagetext" the censored words were still there and in some magical way they were only parsed before storing as a "parsed-post". I kind of new this was wrong, but was still hoping. Anyway, no-go.
One problem I noticed was the check for censored words via "fetch_censored_text" occurs everywhere for different contexts. It simply censors the string without caring from where it came from. I think I would want to write an interim function for "Fetch_censored_text" which stores the censored words and the context from which it came. In this way you can store the censored text from other areas of the board. The title of the post for example, Social group messages or CMS articles.
If you just wanted to just handle the "post text" then of course that would simplify the process -- there would be no reason to store the context.
It looks to me that if we used "class_dm_threadpost.php" --> class method "vB_DataManager::verify_pagetext" and extend the class with a modified method "verify_pagetext" --> which would call a modified function "fetch_sensored_text", where we would store the sensor-ed words in the new table that was created. We could simply add a simple AJAX call to query and display the results, since only admins and maybe mods would be using it.
Anyway, it does seem to be possible.
Max Taxable
06-14-2014, 01:43 AM
If you just wanted to just handle the "post text" then of course that would simplify the process -- there would be no reason to store the context.
It looks to me as if you use "class_dm_threadpost.php" --> class method "vB_DataManager::verify_pagetext" and extend the class with a modied method "verify_pagetext" --> that would call my modified function "fetch_sensored_text", where I would store the sensor-ed words in my new table. You could simply add a simple AJAX call to query and display the results, since only admins and maybe mods would be using it.
Anyway, it does seem to be possible.That's interesting and seems a elegant way of accomplishing this.
Code it! :D
CAG CheechDogg
06-14-2014, 06:46 AM
Yeah yeah..what he (Max) said ! lol ...:D
ozzy47
06-14-2014, 11:14 AM
<a href="https://vborg.vbsupport.ru/showthread.php?t=310258" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=310258</a>
Maybe this mod?
BasicGreatGuy
06-14-2014, 12:50 PM
https://vborg.vbsupport.ru/showthread.php?t=310258
Maybe this mod?
When a regular member posts a curse word, he or she, along with the rest of the forum sees ***. The admins and mods of the site in question would like the ability to see the curse word that was posted without the ***, while still showing *** to the regular members.
Unless I misread your mod, it doesn't appear to have the ability to do what the admins and mods of this site are looking for.
ozzy47
06-14-2014, 01:21 PM
Correct it does not do that, if I get some time I can see what I can do.
Yes I hadn't thought of that. That check would merely allow those usergroups to not have to pass the censor.
But the basic idea wasn't too bad. If you had a "staff only" bbocde you could change the censoring function to replace the word with that bbcode instead of asterisks. But I don't know if that bbcode exists (IIRC nhawk has a paid version of a "members only" bbcode that might allow you to choose the usergroups).
Max Taxable
06-14-2014, 02:05 PM
https://vborg.vbsupport.ru/showthread.php?t=310258
Maybe this mod?No Man... Of all people you should know I look over all your Mods first, anytime I am looking for something.
Oh and, please check your PM inbox.
BasicGreatGuy
06-14-2014, 05:29 PM
Correct it does not do that, if I get some time I can see what I can do.
That would be great. And thanks to Kevin and Max as well :)
BasicGreatGuy
06-30-2014, 12:24 AM
Bumping to see if others are interested in a mod like this, and also see if anyone has made progress in developing one?
BasicGreatGuy
08-02-2014, 11:22 PM
Bumping in hopes someone can create a mod like this.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.