PDA

View Full Version : Human Verification Manager per subforum


James T Brock
12-29-2010, 05:14 PM
Right now I can enable and disable human verification manager on a per usergroup basis but how about adding the option on a SUBFORUM basis. I have one specific subforum where I would like this to be enabled so that users can't post new threads without first completing the CAPTCHA process. This is to prevent bots that like to spam one specific subforum I have.

Anyone want to take on this mod? Or know of a similar mod that I could use for this purpose?

kh99
12-29-2010, 06:21 PM
You could enable human verification for posting, then disable it for all but one forum by creating this plugin using hook location global_setup_complete:

if ((THIS_SCRIPT == 'newthread' AND $foruminfo['forumid'] != 2) OR
(THIS_SCRIPT == 'newreply' AND $threadinfo['forumid'] != 2))
{
$vbulletin->options['hvcheck'] &= ~($vbulletin->bf_misc_hvcheck['post']);
}


of course, change the 2's to the forum id where you want CAPTCHA.

James T Brock
12-29-2010, 08:43 PM
Thank you sir! It works. Exactly what I wanted.

kh99
12-29-2010, 08:48 PM
I'm glad it works - but now that I think about it it seems kind of backwards the way I did it - you could probably check for that forum and set the bit (and not have to enable CAPTCHA for posting) instead of clearing the bit. Oh well.

James T Brock
12-31-2010, 11:21 AM
How do I change the code to do it the way you just described? I just noticed that turning on the CAPTHA disables my quick reply box even in forums where it's not set to have the CAPTHA. Any help would be appreciated.

kh99
12-31-2010, 06:38 PM
Try this code instead:



$hv_forums = array(1, 2, 3); // fset to forum ids where hv is required

if ((THIS_SCRIPT == 'newthread' AND in_array($foruminfo['forumid'], $hv_forums)) OR
(THIS_SCRIPT == 'showthread' AND in_array($threadinfo['forumid'], $hv_forums)) OR
(THIS_SCRIPT == 'newreply' AND in_array($threadinfo['forumid'], $hv_forums)))
{
$vbulletin->options['hvcheck'] |= ($vbulletin->bf_misc_hvcheck['post']);
}

James T Brock
01-01-2011, 10:33 AM
I actually couldn't get that second code to work at all. Not sure if there is a mistake in the script or something. I ended up taking the original code and adding the showthread bit from the second code to get the quick reply to come back...

if ((THIS_SCRIPT == 'newthread' AND $foruminfo['forumid'] != XX) OR
(THIS_SCRIPT == 'showthread' AND $threadinfo['forumid'] != XX) OR
(THIS_SCRIPT == 'newreply' AND $threadinfo['forumid'] != XX))
{
$vbulletin->options['hvcheck'] &= ~($vbulletin->bf_misc_hvcheck['post']);
}

kh99
01-01-2011, 01:09 PM
That's great - yeah, I was thinking once I figured out that I needed to add the showthread part that maybe that was the real cause of the quick reply problem. But I did test that second code I posted. Maybe it has something to do with hv settings - but as long as it's working for you it doesn't matter.