To have my users automatically redirect to the form results page where they can edit their entries if they exceeded their maximum entries, I use this code in plugin
Easy Forums Part 1
Code:
if (!$formresult && $form[submitlimitperuser] >= 1)
{
$userids = $form[userids];
$userid = $vbulletin->userinfo[userid];
$count = substr_count(",$userids,", ",$userid,");
if ($count >= $form[submitlimitperuser])
{
$vbulletin->url = "misc.php?do=formresults&fid=" . $fid;
eval(print_standard_redirect('redirect_deleteq'));
//$errormessage = "Error, you have exceeded limit for number of times this form can be submitted.";
//eval(standard_error($errormessage));
}
}
I use this product as a review type. For each form a user can only have one entry. As I only have one entry to be displayed on this page anyway, I am redirecting my user to the edit page directly. For doing that I need the id of the formresults table:
Code:
$id = $db->query_first("SELECT id FROM " . TABLE_PREFIX . "formresults WHERE fid = '$fid' AND userid = " . $vbulletin->userinfo[userid] . "");
$vbulletin->url = "misc.php?do=editformresult&id=" . $id[id] . "&fid=" . $fid;
eval(print_standard_redirect('redirect_deleteq'));