Thread: New Posting Features - Form Hack
View Single Post
  #335  
Old 03-11-2007, 01:57 PM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01180 seconds
  • Memory Usage 1,774KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete