PDA

View Full Version : Limit threads


trick2008
05-09-2008, 02:46 AM
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 (http://www.vbulletin.com/docs/html/main/add_plugin?manualversion=30506500)):

// 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
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

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 1210461601 at 1210461601 ---------------

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'