vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Human Verification Manager per subforum (https://vborg.vbsupport.ru/showthread.php?t=256137)

James T Brock 12-29-2010 05:14 PM

Human Verification Manager per subforum
 
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:

Code:

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:

PHP Code:


$hv_forums 
= array(123); // 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...

PHP Code:

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.


All times are GMT. The time now is 11:56 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01053 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete