Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Form Hack Details »»
Form Hack
Version: 4.1, by Abe1 Abe1 is offline
Developer Last Online: Jun 2010 Show Printable Version Email this Page

Category: New Posting Features - Version: 3.6.x Rating:
Released: 09-14-2006 Last Update: 04-23-2008 Installs: 1216
Uses Plugins Template Edits
 
No support by the author.

Form Hack 4.1


Features:

Ever wanted an online form that a user can fill out, which when submitted gets:
  • Posted into a new thread in a forum of your choice
  • Create a new poll in the new thread with options of your choice
  • Posted as a reply in an existing thread of your choice
  • PMed to you or someone else
  • Emailed to an email address you specify
  • Choose to redirect to the post, thread or forum, or a custom thank you message
  • Choose to redirect to edit post
  • See a preview before they submit

Or any combination or all of the above?

Well, this is the hack for you!

You can use this for:
  • Moderator Applications
  • Quiz Submit Form which gets PMed to a moderator
  • Contact Form that goes to PM, email or thread
  • Guests to apply to be members
  • Report a Moderator form that goes as a PM to you
  • Guests can PM you for whatever reason
  • Order form to buy things
  • Donation form
  • News or Articles submissions that can go straight to a thread

Or anything you like - this hack is totally customizable via the AdminCP.

The beauty of this hack is that once you install this hack, to make a new form all you need to do is copy the main hook, rename it to whatever you want, edit the variables in the hook, and you have a totally new form!!! You do not need to touch the templates again, but can always create new ones and use different templates for different forms.

Format of the form:
  • One main input question
  • 3 Radio buttons Choice questions
  • 3 Normal text input questions
  • 1 Drop down menu
  • 3 Check boxes
  • 1 Long answer question
  • 1 VB message editor text box question
  • Upload attachments

This is customizable via the hook.

Also:
  • You can set the usergroups you want access to this form.
  • Depending on your forum permissions, if the new thread is in a public forum, members can reply to it. This hack allows a form to submit the new thread or post wherever you want it to go.
  • Force the user to answer all questions.

INSTALLATION
Easy - takes only a few minutes:
  • Import the XML into products. (admin cp -> Plug-in System -> Manage Products -> Add/Import Product)
  • Edit the main plug-in - the instructions are all inside the hook itself, in the top half. Follow the instructions carefully!
  • To get to the form, go to: /newthread.php?do=form (change "form" to the name of your form if you have few)

Done!

Use this hack to make as many forms as you like!

Enjoy!

Updates:

Version 4.0: (09/15/2006)
  • Ported over for vb3.6
  • Send to multiple emails.
  • Send multiple PMs.
  • Parse emails for BBCode
  • And finally, ATTACHMENTS!

Version 4.1: (04/24/2008)
  • Fixed for vb 3.6.10
  • Small bug fixed.
  • List of the 2 quick edits are in the zip file so you don't have to start making a form from scratch.

MAKE SURE YOU CLICK INSTALL!
You will get an email when a new version is released.

Abe1 with rights from Dr Erwin Loh

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #1332  
Old 12-10-2008, 04:59 AM
Grimbone Grimbone is offline
 
Join Date: Mar 2004
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I cannot find my templates to edit anywhere at all. When i goto Style Manager -> Edit Templates nothing is listed at all under custom templates. Clearly the templates have to be somewhere because my test page is showing the form I have been working on in the Plugin PHP Code section.

http://www.legacyofthehorde.com/foru...hp?do=wow_form

The Plugin Code shows...

PHP Code:
// Name of the main template
$maintemplate "form";
// Name of the answer template
$answertemplate "formanswers"
but I cannot find the templates.

Any ideas?
Reply With Quote
  #1333  
Old 12-10-2008, 10:10 AM
WNxWakko's Avatar
WNxWakko WNxWakko is offline
 
Join Date: Apr 2003
Location: Paradise, Texas
Posts: 309
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Since my upgrade to 3.7, i get an error when viewing a form that is intended for those not logged in. The error only displays if you are not logged in and yes I have the guest variable enabled.

Quote:
Fatal error: Call to undefined function fetch_registration_string() in /warriornation.net/httpdocs/Forum/newthread.php(74) : eval()'d code on line 4253
EDIT, took out all the image verification and the error is gone. However submitting forms as unregistered isnt working anymore. I get the confirmation message as if its worked, however the thread never shows up in the forum specified. Yes i have unregistered usergroup post ability enabled in it.
Reply With Quote
  #1334  
Old 12-10-2008, 01:10 PM
meissenation meissenation is offline
 
Join Date: Apr 2005
Posts: 476
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Grimbone View Post
I cannot find my templates to edit anywhere at all. When i goto Style Manager -> Edit Templates nothing is listed at all under custom templates. Clearly the templates have to be somewhere because my test page is showing the form I have been working on in the Plugin PHP Code section.

http://www.legacyofthehorde.com/foru...hp?do=wow_form

The Plugin Code shows...

PHP Code:
// Name of the main template
$maintemplate "form";
// Name of the answer template
$answertemplate "formanswers"
but I cannot find the templates.

Any ideas?
It's not listed under custom templates but it will be listed in the list of templates alphabetically. Scroll down to the "F" templates and you'll see it.
Reply With Quote
  #1335  
Old 12-10-2008, 07:54 PM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by meissenation View Post
D'oh - thank you sir! I left everything for Registered Users set to No under the Forum Permissions but changed the Upload Attachments to Yes and now it appears

Edit: Well - one step forward, but not quite there. If I make it so they can upload attachments it gives them the button for the attachments but it does not allow them to actually attach to the form. I have to make it so it goes to a forum that's off limits to Registered Users due to personal information being posted in the form (Address, phone #, email, etc) but really want them to be able to attach.
When you say it doesn't allow them, what does it do exactly? Does no upload form show up, or does it restrict the posting of the message upon submit? Check your Message Attachment Options as well under vBulletin Options.


Quote:
Originally Posted by Grimbone View Post
I cannot find my templates to edit anywhere at all. When i goto Style Manager -> Edit Templates nothing is listed at all under custom templates. Clearly the templates have to be somewhere because my test page is showing the form I have been working on in the Plugin PHP Code section.

http://www.legacyofthehorde.com/foru...hp?do=wow_form

The Plugin Code shows...

PHP Code:
// Name of the main template
$maintemplate "form";
// Name of the answer template
$answertemplate "formanswers"
but I cannot find the templates.

Any ideas?
The Custom Templates list is for templates YOU create. Modifications generally put their templates, as meissenation mentioned, alphabetically in the main template listing.


Quote:
Originally Posted by WNxWakko View Post
Since my upgrade to 3.7, i get an error when viewing a form that is intended for those not logged in. The error only displays if you are not logged in and yes I have the guest variable enabled.



EDIT, took out all the image verification and the error is gone. However submitting forms as unregistered isnt working anymore. I get the confirmation message as if its worked, however the thread never shows up in the forum specified. Yes i have unregistered usergroup post ability enabled in it.
Only other thing I can think of is to check to the forum ID variable in the plugin, as well as ENABLE FORM TO BE POSTED setting.
Reply With Quote
  #1336  
Old 12-10-2008, 08:50 PM
Grimbone Grimbone is offline
 
Join Date: Mar 2004
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for point me in the right direction!

Great mod!
Reply With Quote
  #1337  
Old 12-10-2008, 11:08 PM
rhamer rhamer is offline
 
Join Date: Nov 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Without sounding stupid, is there a complete idiots guide to getting this working?

I am a new forum admin, but I am a programmer (not PHP) and I am struggling to understand how this all hangs together and how to make it work.

I imported the XML file with the product manager.
I then found the plugin and edited that, although I didnt make any changes.
I figured that the PHP code was what generated the form, so I left that alone for the minute to just get something to work.

However I don't know how to get this to trigger from a forum i.e when I press the new thread button, I don't get the form.

I assume you enable it somehow for each forum.

I also don't understand the relationship between the product and the plugin. Do you use the priduct to create multiple plugins as needed? How are they named and how does the name relate to which form you want displayed in each forum?

I tried reading this entire thread, but 90 pages is beyond me making sense of it.

Any help and guidence would be most appreciated.

Cheers

Rohan
Reply With Quote
  #1338  
Old 12-11-2008, 04:46 AM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rhamer View Post
Without sounding stupid, is there a complete idiots guide to getting this working?

I am a new forum admin, but I am a programmer (not PHP) and I am struggling to understand how this all hangs together and how to make it work.

I imported the XML file with the product manager.
I then found the plugin and edited that, although I didnt make any changes.
I figured that the PHP code was what generated the form, so I left that alone for the minute to just get something to work.

However I don't know how to get this to trigger from a forum i.e when I press the new thread button, I don't get the form.

I assume you enable it somehow for each forum.

I also don't understand the relationship between the product and the plugin. Do you use the priduct to create multiple plugins as needed? How are they named and how does the name relate to which form you want displayed in each forum?

I tried reading this entire thread, but 90 pages is beyond me making sense of it.

Any help and guidence would be most appreciated.

Cheers

Rohan
Most of this is explained in the supplied documentation, but basically, you only need to edit the plugin and the two templates. The $variables are defined in the plugin. If you tell the plugin that $firstname is equal to "First Name", then every instance of $firstname in the template will convert to First Name.

You don't necessarily have to do that for all text, as is shown in the example plugin, but you do need to do it for the form areas. Open the plugin again and go through the area again line by line. There's instructions all through the plugin on what does what and what needs to be configured. In fact, most, if not all of the documentation was worked into the plugin's comments.
Reply With Quote
  #1339  
Old 12-11-2008, 07:15 AM
rhamer rhamer is offline
 
Join Date: Nov 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Jedi, I have now got it working.

The biggest problem I had was understanding how it worked, I didn't realise that this was a page that you linked to, that in turn took the results and posted them. I was thinking the form would appear when I clicked the "New Thread" button on a nominated forum.

I do however have a couple of questions.

How do I stop guests from using the form? i.e make the submit not work if your not logged on and
Can the formanswer template have HTML tags in it like <b></b>? I tried adding them but it just showed the tags in the result.

Cheers

Rohan
Reply With Quote
  #1340  
Old 12-11-2008, 11:20 AM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rhamer View Post
Thanks Jedi, I have now got it working.

The biggest problem I had was understanding how it worked, I didn't realise that this was a page that you linked to, that in turn took the results and posted them. I was thinking the form would appear when I clicked the "New Thread" button on a nominated forum.

I do however have a couple of questions.

How do I stop guests from using the form? i.e make the submit not work if your not logged on and
Can the formanswer template have HTML tags in it like <b></b>? I tried adding them but it just showed the tags in the result.

Cheers

Rohan
It won't accept HTML, I presume, for security reasons. But you can use BBCode, as long as you keep the variables a space away for the code. At least, my experience has been that it doesn't like it if you do this: [b]$variable[/b] It only likes this:[b] $variable [/b]

Guests permissions is a variable in the plugin.
Reply With Quote
  #1341  
Old 12-11-2008, 06:45 PM
etzero etzero is offline
 
Join Date: Mar 2007
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

DJ, This is a question in referance to post #1313 where a someone asked:

Quote:
I use the forms for an application process and it is submitted into an area that only certain people have access to. The applicants cannot read the area it is submitted to but I found out that they can subscribe to the thread and be sent the replies. How can I deny anyone from subscribing in that section?
Which I think I may have found a solution to. If you could please verify or deny this I would appreciate it.

The default code looks like this:

Code:
if ($vbulletin->userinfo['autosubscribe'] != -1)
			{
				$newpost['emailupdate'] = $vbulletin->userinfo['autosubscribe'];
			}
			else
			{
				$newpost['emailupdate'] = 9999;
			}
My thought is that it if changed to this it should always delete the users subscrition regardless if he was set up though the user CP.

Code:
$newpost['emailupdate'] = 9999;

By looking at functions_newpost.php, '9999' apears to be the correct value to delete any subscritions for that thread?

Code:
// ### DO THREAD SUBSCRIPTION ###
	if ($vbulletin->userinfo['userid'] != 0)
	{
		require_once(DIR . '/includes/functions_misc.php');
		$post['emailupdate'] = verify_subscription_choice($post['emailupdate'], $vbulletin->userinfo, 9999);

		($hook = vBulletinHook::fetch_hook('newpost_subscribe')) ? eval($hook) : false;

		if (!$threadinfo['issubscribed'] AND $post['emailupdate'] != 9999)
		{ // user is not subscribed to this thread so insert it
			/*insert query*/
			$vbulletin->db->query_write("INSERT IGNORE INTO " . TABLE_PREFIX . "subscribethread (userid, threadid, emailupdate, folderid, canview)
					VALUES (" . $vbulletin->userinfo['userid'] . ", $threadinfo[threadid], $post[emailupdate], $post[folderid], 1)");
		}
		else
		{ // User is subscribed, see if they changed the settings for this thread
			if ($post['emailupdate'] == 9999)
			{	// Remove this subscription, user chose 'No Subscription'
				$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "subscribethread WHERE threadid = $threadinfo[threadid] AND userid = " . $vbulletin->userinfo['userid']);
			}
			else if ($threadinfo['emailupdate'] != $post['emailupdate'] OR $threadinfo['folderid'] != $post['folderid'])
			{
				// User changed the settings so update the current record
				/*insert query*/
				$vbulletin->db->query_write("REPLACE INTO " . TABLE_PREFIX . "subscribethread (userid, threadid, emailupdate, folderid, canview)
					VALUES (" . $vbulletin->userinfo['userid'] . ", $threadinfo[threadid], $post[emailupdate], $post[folderid], 1)");
			}
		}
	}
It seems counter intuitive as I would have guessed a value of ‘0’ would remove subscriptions.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:44 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05431 seconds
  • Memory Usage 2,349KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (3)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete