I figured out a cool method of redirecting to the post (option "1" in the Form Hack) if you're a registered user, admin, etc. but redirecting Unregistered Users to the "Thank you" message telling them that their form will be put in queue for moderation. This prevents the "Invalid Thread specified" errors if you moderate Unregistered Users form submissions and have the redirect set to "1".
1. First you need to change the Forum Permissions so that Unregistered can Post New Threads in the forum your Form Hack uses. You'll have to disable Image Verification for guests, though.. but I don't find it a problem since I don't allow Guests to post in any of my forums. Does anyone know if there is a forum-specific Image Verification hack??
2. Open up the Form Hack plugin. Set the "$redirectoption" to "1". You can also do this to 2-4, but I haven't tried it. If you do it for 2-4, make sure to change the correct "redirectoption" in the next step.
3. Find
Code:
if ($redirectoption == "1")
{
$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]";
eval(print_standard_redirect('redirect_postthanks'));
exit();
}
and replace with
Code:
if ($redirectoption == "1" AND in_array($vbulletin->userinfo['usergroupid'], array(2,5,6,7)))
{
$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]";
eval(print_standard_redirect('redirect_postthanks'));
exit();
}
You can change
2,5,6,7 to whatever Usergroup IDs you WANT to redirect to the post, thread, etc. Just make sure you exclude Unregistered users..you will get the redirect error, since the post doesn't exist because it's still in Moderation.
4. Configure the "$errormessage" to tell the Unregistered users that their submitted form has been put in queue for moderation.
Quote:
Thank you for submitting this form!
<br /><br />
If you are unregistered or not logged in this will be added to the queue for moderation. You will not see this thread until we approve it.
<br /><br />
Thank you! You may return to the forum <a href=\"http://www.YOURDOMAIN.com/forums/forumdisplay.php?f=X\">Here.</a>
|
If you are going to use any kind of HTML (with quotations) in your message, you must put a backward slash
\ in front of each quotation mark
". Otherwise you will get parse errors. Make sure to change
YOURDOMAIN, and
X to the proper Forum ID.
Well I'm off to figure out how to do the "Thank You" message AND automatically redirect back to the forum now that I've gotten part way there. You can also use my method above for different reasons. It's essentially allowing you 2 redirect options instead of one.