vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Limit threads (https://vborg.vbsupport.ru/showthread.php?t=178605)

trick2008 05-09-2008 02:46 AM

Limit threads
 
I am after a modification that allows admin to set a limit on threads in a specific forum for members.

EG you have a signature forum and members can only create new threads once every 7 days...

Thanks!

calorie 05-09-2008 03:42 AM

Untested but try adding the following plugin at the newthread_start hook (how to add a plugin):
Code:

// change X to the forum ID of the signature forum
// change 7 to how many days to prevent new threads

if ($foruminfo['forumid'] == X)
{
        $sigforum_check = $db->query_first("SELECT COUNT(1) AS cnt
                FROM " . TABLE_PREFIX . "thread
                WHERE postuserid = " . $vbulletin->userinfo['userid'] . "
                AND forumid = " . $foruminfo['forumid'] . "
                AND dateline > " . TIMENOW . " - (86400 * 7)
        ");

        if ($sigforum_check['cnt'])
        {
                print_no_permission();
        }
}


trick2008 05-09-2008 06:40 AM

nope i get an error:( thanks though

Lynne 05-09-2008 02:52 PM

Quote:

Originally Posted by trick2008 (Post 1513484)
nope i get an error:( thanks though

If you want help, you might want to post exactly what you put in your plugin/templates and tell us what the error is.

trick2008 05-10-2008 10:15 PM

well i put this in as my code

Quote:

if ($foruminfo['forumid'] == 7)
{
$sigforum_check = $db->query_first("SELECT COUNT(1) AS cnt
FROM " . TABLE_PREFIX . "thread
WHERE postuserid = " . $vbulletin->userinfo['userid'] . "
AND forumid = " . $foruminfo['forumid'] . "
AND dateline > " . TIMENOW . " - (86400 * 7)
");

if ($sigforum_check['cnt'])
{
print_no_permission();
}
}
as advised, i am not getting a error now, but users can still post in the forum after they have already posted

WhaLberg 05-10-2008 10:17 PM

This doesn't prevent them from posting after their post, this does prevent them from opening another thread.

trick2008 05-10-2008 10:18 PM

ya it didnt prevent that, but i took out the second = sign in the first line and it now works. thanks!!!!

--------------- Added [DATE]1210461601[/DATE] at [TIME]1210461601[/TIME] ---------------

How would i set it up so when they do try to create a new thread the error message says 'you have already requested in the last 7 days'


All times are GMT. The time now is 08:41 PM.

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.02482 seconds
  • Memory Usage 1,730KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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