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
  #1262  
Old 09-19-2008, 11:23 AM
viper357's Avatar
viper357 viper357 is offline
 
Join Date: Dec 2006
Location: Worthing, UK
Posts: 563
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can somebody please help with why I am getting this error when I submit the form.

Fatal error:

* Please complete both the subject and message fields.

Unable to proceed with save while $errors array is not empty in class vB_DataManager_PM in /includes/class_dm.php on line 763
Reply With Quote
  #1263  
Old 09-24-2008, 11:47 PM
Bilderback's Avatar
Bilderback Bilderback is offline
 
Join Date: Sep 2007
Location: Illinois
Posts: 214
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You have to be very careful with this form as you will get data manager errors if you have multiple forms using the same variables.
My advice is to become very familiar with the form before using it.
This way , you can create your own variable.
Example:
Instead of
$question1="What is your name?";
you can write your own variable...
$form_one_question1="What is your name?";
or
$form_one_name="What is your name?";
Definitely not for the impatient but a great product.

There are a few bugs like if you have a question:
Do you have a name? If yes, please state your name.
Someone can still choose no and state their name so it shows as:
No
My Name

I have found a quick fix conditional to add to your formanswers template that works fairly well for me.
Code:
<if condition="$radioanswer1other!=''">yes<else />$radioanswer1</if>
What this does is if the name area is not empty, it changes the No to Yes.
So your actual code for the question assuming it is $radioquestion1 is as follows:
Code:
$radioquestion1
<if condition="$radioanswer1other!=''">yes<else />$radioanswer1</if>
$radioanswer1other
I have to say I am having fun with this hack.
Another thing I noticed is that HTML is not parsing in the formanswers template
and any BBCode produces errors.
Is there any way around this?
I would like to add some styling to the form when it is posted to a thread like using Bold and Underline and possibly a hyperlink to various answers.
Thanks
Reply With Quote
  #1264  
Old 09-28-2008, 01:09 PM
swisscotton swisscotton is offline
 
Join Date: Apr 2008
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have installed this hack but for some reason the answers to the normal questions ($question) are not showing up on priview or when its submitted.

My PHP isn't very good at all so I was hoping someone for have a quick look for me?
http://www.fileden.com/files/2007/3/...ot_working.txt

Emma
Reply With Quote
  #1265  
Old 09-28-2008, 03:41 PM
Bilderback's Avatar
Bilderback Bilderback is offline
 
Join Date: Sep 2007
Location: Illinois
Posts: 214
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Part 1 and Part 2 have to be the same for your answer variables.
My suggestion is to first write down all questions and answers, then add to form.
Example:
$question1 = "What is the Rabbits Name?";
$explain1 = "Please enter your real name here.";

In question1, you would only need to clean the answer1
(your own questions and explains dont need to be run through the vb input.)
Code:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
));
// Part 2
$answer1 = $vbulletin->GPC['normalanswer1'];
You also need to be sure that all the same $variables are distributed properly to the templates.
form template
Code:
<tr>
<td class="alt2" valign="middle">
<b>$question1</b>:<br />
$explain1</td>
<td class="alt2" valign="middle" colspan="2">
<input type="text" size="30" value="$answer1" name="answer1" /></td>
</tr>
answer template
Code:
$question1
$answer1
Reply With Quote
  #1266  
Old 09-28-2008, 03:54 PM
Nuguru Nuguru is offline
 
Join Date: Jun 2006
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,

Great mod, but has this mod been updated to work with vb 3.7.3 or above?

Thx
Reply With Quote
  #1267  
Old 09-28-2008, 07:03 PM
swisscotton swisscotton is offline
 
Join Date: Apr 2008
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Bilderback View Post
Part 1 and Part 2 have to be the same for your answer variables.
My suggestion is to first write down all questions and answers, then add to form.
Example:
$question1 = "What is the Rabbits Name?";
$explain1 = "Please enter your real name here.";

In question1, you would only need to clean the answer1
(your own questions and explains dont need to be run through the vb input.)
Code:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
));
// Part 2
$answer1 = $vbulletin->GPC['normalanswer1'];
You also need to be sure that all the same $variables are distributed properly to the templates.
form template
Code:
<tr>
<td class="alt2" valign="middle">
<b>$question1</b>:<br />
$explain1</td>
<td class="alt2" valign="middle" colspan="2">
<input type="text" size="30" value="$answer1" name="answer1" /></td>
</tr>
answer template
Code:
$question1
$answer1
Thanks for that. But I really can't do it. I don't know PHP at all. I have tried tweaking it but nothing is appearing. I have tried going back to the default form and inputting it again but I am still not getting the answers appearing
Reply With Quote
  #1268  
Old 09-28-2008, 07:39 PM
swisscotton swisscotton is offline
 
Join Date: Apr 2008
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not only dosn't it display the ansewrs its still only showing the first three questions on preview (I have added them into the html).

http://www.fileden.com/files/2007/3/...t_working2.txt

I know is something I am doing wrong because I am a designer and know nothing what so ever about this kind of thing. It is a very basic form I am trying to put together.
Reply With Quote
  #1269  
Old 09-29-2008, 12:37 AM
Bilderback's Avatar
Bilderback Bilderback is offline
 
Join Date: Sep 2007
Location: Illinois
Posts: 214
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Like I stated in a previous post, its more coder-oriented and without much documentation.
The idea is to first develop your variables list
(Note:You only have to use the vbulletin cleaner on a variable which will allow user input.)
So if my first question was:
$question1="What is your name?";
$explain1="Please enter your name here";
Neither of those have to be passed through vb input cleaner.
-only the $answer1 since it takes user input.
I clean everything... even radio boxes that you think would only be a Yes or No,
just in case a hacker tries to manipulate any input variables.

You cannot use the same variable twice or it is overwritten resulting in possible errors.
So you cannot do:
$question1="What is your name?";
$question1="How old are you?";
This is basic variable handling as you are redeclaring the var resulting in it being overwritten.
If you are trying to use the default form as reference as you make a custom form,
the script is being executed ,corrupting default variables if you are not assigning your own.
So I recommend disabling the default form if you make custom.

After all your variables are assigned properly within the plugin, you then edit the form template
to your liking which takes basic vbulletin template handling.

And also do the same with the output template (answer template) which will be the
template that posts to your thread or post.
Both templates have to use the same variables as you stated in the form plugin.

The easiest way I have found is to write down my questions and answers on paper
or in editor so that I have a basic set.
Then, I go through and create the variables, place them in the order I want in the templates,
and everything should work.

It takes a bit of a learning curve but well worth it.
Maybe someday, the Form Hack will be enhanced to set up the form from adminCP area.
Reply With Quote
  #1270  
Old 09-30-2008, 11:54 AM
swisscotton swisscotton is offline
 
Join Date: Apr 2008
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont know what you mean by "cleaning" I am new to VB and I haven't a clue about PHP but this forum is an importent part of my forum.

This is how it is set up so far:

Quote:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
'$vbtextexplain' => TYPE_STR,
));

// Part 2
$answer1 = $vbulletin->GPC['normalanswer1'];
$longanswer1 = $vbulletin->GPC['longanswer1'];

Quote:
//QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question1 = "What is the Rabbits Name?";
$explain1 = "Please enter your real name here.";

//QUESTION 2 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question2 = "What breed is the Rabbit?";
$explain2 = "Please enter your real name here.";

//QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question3 = "Is the rabbit spayed or neutered?";
$explain3 = "Please enter your real name here.";

//QUESTION 4 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question4 = "How old is the Rabbit?";
$explain4 = "Please enter your real name here.";

//QUESTION 5 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question5 = "What colour is the rabbit?";
$explain5 = "Please enter your real name here.";

//QUESTION 6 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question6 = "Bonded or Single Rabbit?";
$explain6 = "Please enter your real name here.";

$vbtextquestion = "Information & Photos";
$vbtextexplain = "Please write more information about the rabbit, such as its background, how you managed to save him or her, the rabbit’s personality, and what the ideal home would be for this rabbit. Also post photos of the rabbit.";
The '$vbtextexplain' => TYPE_STR, (text area) works find its just the normal answers that don't.

I a run an animal welfare forum and this form will be used for animals needing homes and to let me know details about the animal so I can put those details onto the site.
Reply With Quote
  #1271  
Old 09-30-2008, 01:20 PM
Bilderback's Avatar
Bilderback Bilderback is offline
 
Join Date: Sep 2007
Location: Illinois
Posts: 214
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Part 1 and Part 2 need to have the same variables which rely on any questions asked.

Code:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
'$answer2' => TYPE_STR,
'$answer3' => TYPE_STR,
'$answer4' => TYPE_STR,
'$answer5' => TYPE_STR,
'$answer6' => TYPE_STR,
));

// Part 2
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$answer4 = $vbulletin->GPC['answer4'];
$answer5 = $vbulletin->GPC['answer5'];
$answer6 = $vbulletin->GPC['answer6'];
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 10:01 PM.


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.05481 seconds
  • Memory Usage 2,340KB
  • 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
  • (9)bbcode_code
  • (3)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
  • (4)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