Is there any way to prevent users from submitting a form more than once per X hours? I am using it to allow people to submit listings in a classifieds forum.
Previously the members just created regular threads in that forum, and I used
this mod to prevent them from posting more than one listing per 8 hours. However, that mod seems to have no effect when the threads are auto created by submitting a form.
This is the code used by my current max posts mod:
Code:
if ($foruminfo['forumid'])
{
$ugroupids = $vbulletin->userinfo['usergroupid'] . iif($vbulletin->userinfo['membergroupids'], "," .
$vbulletin->userinfo['membergroupids']);
$fids = $forumid . iif($foruminfo['parentlist'], "," . $foruminfo['parentlist']);
$result1 = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "forumpermission
WHERE ( forumid IN($fids) AND usergroupid IN ($ugroupids)) AND
(maxthread=0 AND perhour=0)");
if (empty($result1))
$result = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "forumpermission
WHERE forumid IN($fids) AND usergroupid IN ($ugroupids)
ORDER BY forumid DESC, maxthread DESC");
if ($result)
{
$maxtime = TIMENOW - ($result['perhour'] * 3600);
$sql = $db->query_first("SELECT count(*) as totalthread FROM " . TABLE_PREFIX . "thread WHERE dateline >=
$maxtime
AND forumid IN($fids)
AND postuserid = " . $vbulletin->userinfo['userid'] . " ");
if ($sql['totalthread'] >= $result['maxthread'])
eval(standard_error(fetch_error('no_new_thread_permission', $result[maxthread], $result[perhour])));
}
}
I want to limit all users to a max of 1 form submission per 8 hours in forum # 17. Is there a modified version of the above code I could put in the Form Hook: Form Start: field to have it work?