View Full Version : Moderators Functions - Unapprove Reported Posts (Based on No. of Reports & Usergroups)
Wonksta
08-12-2011, 10:00 PM
This modification has been based on the following Mod found here: https://vborg.vbsupport.ru/showthread.php?t=231622 - I have been given permission by that author to release this modified version of his original Mod.
This modification adds much needed features such as:
- Number of Reports required to send a post in Moderation Queue
- Usergroups which can bypass min. reports required.
Anyone who makes changes to this modification to better it in anyway, I only ask you share it with the rest of us in this thread! :)
Enjoy!
0ptima
08-13-2011, 12:36 PM
Will check this out soon!
Manoel J?nior
08-13-2011, 01:31 PM
Tagged
inciarco
08-13-2011, 02:25 PM
Very Interesting Mod, Thank You For Sharing It. :up:
The Code Alters the "post" Table adding the Field "reports", You Should Add the "DB Changes" in the Mod's Specifications. :confused:
ALTER TABLE " . TABLE_PREFIX . "post ADD reports INT(10) UNSIGNED NOT NULL DEFAULT '0'
My Best Regards.
:)
BirdOPrey5
08-13-2011, 04:39 PM
Very Interesting Mod, Thank You For Sharing It. :up:
The Code Alters the "post" Table adding the Field "reports", You Should Add the "DB Changes" in the Mod's Specifications. :confused:
ALTER TABLE " . TABLE_PREFIX . "post ADD reports INT(10) UNSIGNED NOT NULL DEFAULT '0'
My Best Regards.
:)
Good catch. I made the change.
MoMan
08-13-2011, 05:48 PM
Very nice and elegant mod!
Ramsesx
08-13-2011, 08:38 PM
Cool, that's what I need, thanks.
MoMan
08-13-2011, 09:15 PM
Not that this really matters, but technically a redundant query is made once a post has enough reports and gets unapproved.
I've updated my plugin code to the following:
if ($_POST['do'] == 'sendemail' AND !empty($_POST['reason']))
{
$reports = $vbulletin->db->query_first("SELECT reports FROM " . TABLE_PREFIX . "post WHERE postid = " . $postinfo['postid']);
if ($reports['reports'] + 1 >= $vbulletin->options['unapprove_reported_posts_num_reports'] OR is_member_of($vbulletin->userinfo, unserialize($vbulletin->options['unapprove_reported_posts_bypass_usergroups'])))
{
$modinfo = fetch_userinfo($postinfo['userid']);
$uglist = $modinfo['usergroupid'] . iif(trim($modinfo['membergroupids']), ",$modinfo[membergroupids]");
if (!can_moderate(0, '', $modinfo['userid'], $uglist) OR ($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
{
require_once(DIR. '/includes/functions_databuild.php');
unapprove_post($postinfo['postid'], ($foruminfo['countposts'] AND !$postinfo['skippostcount']), true, $postinfo, $threadinfo, false);
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = 0 WHERE postid = " . $postinfo['postid']);
}
else
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = reports + 1 WHERE postid = " . $postinfo['postid']);
}
}
else
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = reports + 1 WHERE postid = " . $postinfo['postid']);
}
}
paul1972
08-17-2011, 01:36 AM
who has this on their website? I'd like to see it in action....please list your website
Wonksta
08-17-2011, 02:03 AM
who has this on their website? I'd like to see it in action....please list your website
You can't see it in action unless you're a Moderator/Admin on the board it is installed on.
This modification works extremely well with the "Quick Moderation" Module with vBAdanced.
Here's a screeny:
paul1972
08-17-2011, 02:38 AM
so if a post get a certain number of complaints then it will be forwarded to a moderators section?
or how does this work?
is there a button to click on to report the violation to the moderators?
Wonksta
08-17-2011, 03:00 AM
so if a post get a certain number of complaints then it will be forwarded to a moderators section?
or how does this work?
is there a button to click on to report the violation to the moderators?
Click on a post and select 'Disapprove' that's all it does to a post/thread.
MoMan
08-18-2011, 09:31 PM
FYI with this mod you get a database error if you try to report a PM/VM/picture comment.
In order to fix this, change the plugin code to the following:
if ($_POST['do'] == 'sendemail' AND isset($postinfo['postid']) AND !empty($_POST['reason']))
{
$reports = $vbulletin->db->query_first("SELECT reports FROM " . TABLE_PREFIX . "post WHERE postid = " . $postinfo['postid']);
if ($reports['reports'] + 1 >= $vbulletin->options['unapprove_reported_posts_num_reports'] OR is_member_of($vbulletin->userinfo, unserialize($vbulletin->options['unapprove_reported_posts_bypass_usergroups'])))
{
$modinfo = fetch_userinfo($postinfo['userid']);
$uglist = $modinfo['usergroupid'] . iif(trim($modinfo['membergroupids']), ",$modinfo[membergroupids]");
if (!can_moderate(0, '', $modinfo['userid'], $uglist) OR ($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
{
require_once(DIR. '/includes/functions_databuild.php');
unapprove_post($postinfo['postid'], ($foruminfo['countposts'] AND !$postinfo['skippostcount']), true, $postinfo, $threadinfo, false);
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = 0 WHERE postid = " . $postinfo['postid']);
}
else
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = reports + 1 WHERE postid = " . $postinfo['postid']);
}
}
else
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = reports + 1 WHERE postid = " . $postinfo['postid']);
}
}
Essentially you are adding isset($postinfo['postid']) to the main conditional.
SnakeV
08-18-2011, 11:15 PM
Good catch.
One question, did you use this mod directly with it's default install code?
ALTER TABLE " . TABLE_PREFIX . "post ADD reports INT(10) UNSIGNED NOT NULL DEFAULT '0'
Because i have also have more than 1.5M of posts like your forum and i think that it could take some time to execute that query.
FYI with this mod you get a database error if you try to report a PM/VM/picture comment.
In order to fix this, change the plugin code to the following:
if ($_POST['do'] == 'sendemail' AND isset($postinfo['postid']) AND !empty($_POST['reason']))
{
$reports = $vbulletin->db->query_first("SELECT reports FROM " . TABLE_PREFIX . "post WHERE postid = " . $postinfo['postid']);
if ($reports['reports'] + 1 >= $vbulletin->options['unapprove_reported_posts_num_reports'] OR is_member_of($vbulletin->userinfo, unserialize($vbulletin->options['unapprove_reported_posts_bypass_usergroups'])))
{
$modinfo = fetch_userinfo($postinfo['userid']);
$uglist = $modinfo['usergroupid'] . iif(trim($modinfo['membergroupids']), ",$modinfo[membergroupids]");
if (!can_moderate(0, '', $modinfo['userid'], $uglist) OR ($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
{
require_once(DIR. '/includes/functions_databuild.php');
unapprove_post($postinfo['postid'], ($foruminfo['countposts'] AND !$postinfo['skippostcount']), true, $postinfo, $threadinfo, false);
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = 0 WHERE postid = " . $postinfo['postid']);
}
else
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = reports + 1 WHERE postid = " . $postinfo['postid']);
}
}
else
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "post SET reports = reports + 1 WHERE postid = " . $postinfo['postid']);
}
}
Essentially you are adding isset($postinfo['postid']) to the main conditional.
home9000
08-20-2011, 11:09 AM
MoMan or anymone
we need this hack updated anyone can help
MoMan
08-25-2011, 12:46 AM
Good catch.
One question, did you use this mod directly with it's default install code?
ALTER TABLE " . TABLE_PREFIX . "post ADD reports INT(10) UNSIGNED NOT NULL DEFAULT '0'
Because i have also have more than 1.5M of posts like your forum and i think that it could take some time to execute that query.
Yes, it will take several seconds - ideally you should close your board, but I decided not to and got no crashes.
JesterP
09-12-2011, 12:37 PM
I can even imagine why this isn't already in vBulletin. Fantastic addition and thank you to the others for the improvements.
Nominated. :)
hpidriver
09-14-2011, 04:11 AM
^^ What version of vb are you running?
marked as tagged
JesterP
10-23-2011, 12:33 AM
I have multiple sites running this, 3.8.x and a couple 4.1.7 forums.
lm3a.net
10-24-2011, 10:33 AM
It's good but after installing it the sending via email for the reported post is not working also after uninstalling the product :(
home9000
03-17-2012, 08:02 PM
I want to prevent a user from use this function
home9000
03-30-2012, 06:39 PM
I want to prevent a user from use this function
or not allow a user to report more than one time for the same post
Raakin
06-12-2012, 06:34 PM
Does it work for 4.1.5?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.