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

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

Version: 3.5.4 Rating:
Released: 08-09-2005 Last Update: 05-30-2006 Installs: 467
Uses Plugins Template Edits
 
No support by the author.

Forms Hack 3.5


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 to upload attachments
  • 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

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 2.0: (08/10/2005)
  • Ported over for vb3.5

Version 2.1: (08/10/2005)
  • bug fix with answers not showing

Version 2.5: (08/13/2005)
  • Major update:
  • Templates have a few lines changed here and there.
  • You can now have more then 2 poll options very easily
  • Polls can't be created if your not creating a new thread
  • New Thread now uses VB function to add the thread
  • New Poll now uses VB function to add the poll
  • New Reply now uses VB function to add the reply
  • PM now uses VB function to send the PM

Version 2.6: (08/21/2005)
  • fixed bug with posts having to be moderated

Version 2.7: (08/23/2005)
  • Minor update:
  • Fixed some issues with signatures, URL parsing, and subscriptions
  • Option to name the post titles
  • Made template XHTML 1.0 Transitional

Version 3.0: (11/29/2005)
  • Major update:
  • Added drop down menu
  • Made the long answer show up in a the vb message box
  • Re-wrote some instructions
  • Pressing back should save work
  • Both templates and plug-in were edited
  • Some more minor things

Version 3.1: (12/07/2005)
  • Brought back the standard text box (longanswer)

Version 3.2: (12/09/2005)
  • [ADDED] Option to make polls public.

Version 3.3: (12/19/2005)
  • [FIXED] Guests can now post using the forms to make a thread or post. They cannot send a PM though.
  • [ADDED] Paypal link so you can make a donation for this hack.

Version 3.4: (04/05/2006)
  • [FIXED] Removed extra line from template.
  • [ADDED] WYSIWYG editor now works besides the regular editor.
  • [ADDED] Preview.
  • [CHANGED] Subscriptions now take from user default setting.

Version 3.5: (05/31/2006)
  • [ADDED] Check boxes.


Abe1 with rights from Dr Erwin Loh

This hack is created for your use free of charge. No payment is requested. However, if you would like to donate money for the work I put in to this hack, a donation would show your appreciation.

Show Your Support

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

Comments
  #797  
Old 04-18-2006, 06:36 PM
SupremeWeapon SupremeWeapon is offline
 
Join Date: Jan 2005
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cleaned th epost up.


When poll is selected I get that fatal error.
When poll isnt selected it goes throug but doesnt post.

Quote:
// To add more then one form, copy this whole text, and creat a new plug-in with the hook location 'newthread_start'.
// After, change the form name. You can't have 2 forms with the same name.

// Name of this form
$formname = "app";

if ($_REQUEST['do'] == $formname)
{

// ################################################## #####################
// ######################## CUSTOMIZE VARIABLES ##########################
// ################################################## #####################

////////////////////////////////////////////////////////////////////////////////////////////////////
////// BEGIN CUSTOMIZATION BELOW////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//VARIABLES
//Study how variables are add here to add or remove any. If you add a variable to your form, you must add it to part one and part two.
////////////////////////////////////////////////////////////////////////////////////////////////////

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'normalanswer1' => TYPE_STR,
'normalanswer2' => TYPE_STR,
'radioanswer1' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'longanswer1' => TYPE_STR
));

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$normalanswer2 = $vbulletin->GPC['normalanswer2'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$longanswer1 = $vbulletin->GPC['longanswer1'];

////////////////////////////////////////////////////////////////////////////////////////////////////
//USERGROUPS ALLOWED
//You can add or remove usegroups that are ALLOWED to use this form by changing the numbers below in the array.
//To enable this feature, remove the '//' before the 'if'.
////////////////////////////////////////////////////////////////////////////////////////////////////

// if (!in_array($vbulletin->userinfo['usergroupid'], array(2,5,6,7))) print_no_permission();

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NAME OF TEMPLATES - DO THIS BIT IF YOU ARE MAKING MORE FORMS AND WANT TO USE A DIFFERENT LOOKING TEMPLATE
////////////////////////////////////////////////////////////////////////////////////////////////////

// Name of the main template
$maintemplate = "form";
// Name of the answer template
$answertemplate = "formanswers";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//CHOOSE WHETHER YOU WANT FORM TO BE POSTED IN A NEW THREAD, NEW POLL, REPLY TO EXISITING THREAD, PMed OR EMAILED
///////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE POSTED - 1 = yes, 0 = no
$formforum = "1";

//FORUM TO POST NEW THREAD IN
//You CAN make this number a variable. You can have a drop down menu or in the link like do=form&f=1. Make sure you add it the variables list.
$formforumid = "11";

//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll = "0";
$polloption[1] = "Yes";
$polloption[2] = "No";
$polloption[3] = "Maybe";

//Make poll public - 1 = yes, 0 = no
$pollpublic = "1";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO REPLY TO EXISTING THREAD - 1 = yes, 0 = no
$formreply = "0";

//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid = "12345";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE PMED (guests CANNOT use this option) - 1 = yes, 0 = no
$formpm = "0";

//USERNAME TO PM TO
$formpmname = "Abe";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE EMAILED - 1 = yes, 0 = no
$formemail = "0";

//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "youremail@yourforums.com";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//REDIRECT OPTIONS:
// 0 - thank you message (thread, reply, pm, or email)
// 1 - redirect to post (thread or reply)
// 2 - redirect to thread (thread only)
// 3 - redirect to forum (thread only)
// 4 - redirect to editpost to upload attachments (thread or reply)
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption = "0";

$errormessage = "Thank you for submitting Your application! We will review it and get back to you."; //This is the thank you message

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
//If you added or deleted variables, you must edit what it checked for. Search for "$answerall ==" and edit 2 lines under it.
////////////////////////////////////////////////////////////////////////////////////////////////////

$answerall = "0";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error, besides the quotes around the whole title)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Team Application";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF THREAD/POST/PM/EMAIL (do not use quotation marks in the title or you will get a parse error)
//You may use variables from the form for this.
////////////////////////////////////////////////////////////////////////////////////////////////////

$posttitle = "$dtrapp";

////////////////////////////////////////////////////////////////////////////////////////////////////
//PURPOSE OF FORM (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formpurpose = "This form is for you to submit an application to join TeamDTR. It does not auto promise you a position on the team.";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion1 = "What is your Online Name?";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion1 = "Who referred you??";

////////////////////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$radioquestion1 = "Do you see yourself as a person who can follow rules set forth?";

// The following choices must NOT have quotation marks
$radiochoice1a = "yes";
$radiochoice1b = "no";

////////////////////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question1 = "What is your REAL 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 is your email?";
$explain2 = "Please enter your real email here.";

//QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question3 = "What games do you play?";
$explain3 = "List your games here. If there isnt enough room then use the last input box..";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//DROP DOWN CHOICES : QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$dropdownquestion1 = "What is your gender?";

// The following choices must NOT have quotation marks
$dropdownchoice1a = "no comment";
$dropdownchoice1b = "male";
$dropdownchoice1c = "female";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//LONG TEXT AREA INPUT: QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$longquestion1 = "Please explain Why you want to join TeamDTR.";
$longexplain1 = "Be specific this will play a role in your applicaion being reviewed.";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//VB TEXT AREA INPUT: You can only have ONE vb text question. (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$vbtextquestion = "Please give us any other info you wish to.";
$vbtextexplain = "Put anhting in here that you feel is worth while to your application.";

////////////////////////////////////////////////////////////////////////////////////////////////
////// END OF CUSTOMIZATION ////////////////////////////////////////////////////////////////////
///// DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!!! ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
if ($_REQUEST['action'] == '')
{
$_REQUEST['action'] = "form";
}


$bbuserinfo = $vbulletin->userinfo;

// start navbar
$navbits = array();
$navbits['newthread.php?' . $vbulletin->session->vars['sessionurl'] . "do=$formname"] = $formtitle;

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

if ($_REQUEST['action'] == "submit")
{

if ($answerall == "1")
{
if ($normalanswer1 == '' OR $radioanswer1 == '' OR $radioanswer2 == '' OR $radioanswer3 == '' OR $answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $longanswer1 == '')
{
$errormessage = "$bbuserinfo[username], you need to answer every question!";
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
exit();
}
}

$vbulletin->input->clean_array_gpc('p', array(
'wysiwyg' => TYPE_BOOL,
'message' => TYPE_STR
));

if ($vbulletin->GPC['wysiwyg'])
{
require_once(DIR . '/includes/functions_wysiwyg.php');
$vbtextanswer = convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $foruminfo['allowhtml']);
}
else
{
$vbtextanswer =& $vbulletin->GPC['message'];
}

eval('$formsend = "' . fetch_template("$answertemplate") . '";');

if ($_POST['submit'] == 'Submit')
{
if ($formforum == "1")
{
$foruminfo = verify_id('forum', $formforumid, 0, 1);
$forumperms = fetch_permissions($foruminfo[forumid]);
$newpost['username'] =& $vbulletin->userinfo['username'];
$newpost['message'] =& $formsend;
$newpost['title'] =& $posttitle;
$newpost['parseurl'] = '1';

if ($vbulletin->userinfo['autosubscribe'] != -1)
{
$newpost['emailupdate'] = $vbulletin->userinfo['autosubscribe'];
}
else
{
$newpost['emailupdate'] = 9999;
}

if ($vbulletin->userinfo['signature'] != '')
{
$newpost['signature'] = '1';
}
else
{
$newpost['signature'] = '0';
}

build_new_post('thread', $foruminfo, array(), array(), $newpost, $errors);

if ($formpoll == "1")
{
$threadinfo = verify_id('thread', $newpost[threadid], 0, 1);
$polloptions = count($polloption);
$question = $posttitle;
$vbulletin->GPC['options'] = $polloption;

$counter = 0;
$optioncount = 0;
$badoption = '';
while ($counter++ < $polloptions)
{ // 0..Pollnum-1 we want, as arrays start with 0
if ($vbulletin->options['maxpolllength'] AND vbstrlen($vbulletin->GPC['options']["$counter"]) > $vbulletin->options['maxpolllength'])
{
$badoption .= iif($badoption, ', ') . $counter;
}
if (!empty($vbulletin->GPC['options']["$counter"]))
{
$optioncount++;
}
}

// Add the poll
$poll =& datamanager_init('Poll', $vbulletin, ERRTYPE_STANDARD);

$counter = 0;
while ($counter++ < $polloptions)
{
if ($vbulletin->GPC['options']["$counter"] != '')
{
$poll->set_option($vbulletin->GPC['options']["$counter"]);
}
}

$poll->set('question', $question);
$poll->set('dateline', TIMENOW);
$poll->set('active', '1');
$poll->set('public', $pollpublic);

$pollid = $poll->save();
//end create new poll

// update thread
$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->set('pollid', $pollid);
$threadman->save();
}
}

if ($formreply == "1")
{
$threadinfo = verify_id('thread', $formreplythreadid, 0, 1);
$forumperms = fetch_permissions($threadinfo[forumid]);
$newpost['username'] =& $vbulletin->userinfo['username'];
$newpost['message'] =& $formsend;
$newpost['title'] =& $posttitle;
$newpost['parseurl'] = "1";

if ($vbulletin->userinfo['autosubscribe'] != -1)
{
$newpost['emailupdate'] = $vbulletin->userinfo['autosubscribe'];
}
else
{
$newpost['emailupdate'] = 9999;
}

if ($vbulletin->userinfo['signature'] != '')
{
$newpost['signature'] = '1';
}
else
{
$newpost['signature'] = '0';
}

build_new_post('reply', $foruminfo, $threadinfo, $postinfo, $newpost, $errors);
}

if ($formpm == "1")
{
$vbulletin->GPC['message'] =& $formsend;
$vbulletin->GPC['title'] =& $posttitle;
$vbulletin->GPC['recipients'] =& $formpmname;

$pm['message'] =& $vbulletin->GPC['message'];
$pm['title'] =& $vbulletin->GPC['title'];
$pm['recipients'] =& $vbulletin->GPC['recipients'];

// create the DM to do error checking and insert the new PM
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);

$pmdm->set('fromuserid', $vbulletin->userinfo['userid']);
$pmdm->set('fromusername', $vbulletin->userinfo['username']);
$pmdm->setr('title', $pm['title']);
$pmdm->setr('message', $pm['message']);
$pmdm->set_recipients($pm['recipients'], $permissions);
$pmdm->set('dateline', TIMENOW);

// everything's good!
$pmdm->save();
}

if ($formemail == "1")
{
vbmail($formemailaddress, $posttitle, $formsend);
}

if ($redirectoption == "1")
{
$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]";
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}
if ($redirectoption == "2")
{
$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t=$newpost[threadid]";
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}
if ($redirectoption == "3")
{
$vbulletin->url = 'forumdisplay.php?' . $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]";
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}
if ($redirectoption == "4")
{
$vbulletin->url = 'editpost.php?do=editpost&' . $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]";
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
exit();
}
else
{
require_once('./includes/class_bbcode.php');
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$preview = $parser->do_parse($formsend);

$_REQUEST['action'] = 'form';
}
}

if ($_REQUEST['action'] == 'form')
{
// set message box width to usercp size
$stylevar['messagewidth'] = $stylevar['messagewidth_usercp'];
$editorid = construct_edit_toolbar($vbtextanswer);

eval('print_output("' . fetch_template("$maintemplate") . '");');
}
}
Reply With Quote
  #798  
Old 04-20-2006, 03:22 PM
mastersite mastersite is offline
 
Join Date: Mar 2006
Location: UK
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi im a complete noob to this mod, and im not sure why the form isn't appearing when i post a new thread.

Ive created a new plugin with the all the code and saved as different title, whatelse is there to do?
Reply With Quote
  #799  
Old 04-21-2006, 09:11 AM
TomasDR TomasDR is offline
 
Join Date: Feb 2006
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I searched the thread but all I found was one user who included a checkbox their template. But is there anyway to add a multiple choice checkbox type question?

If not, are there any plans to include that feature?

Recent Install and liking it!
Reply With Quote
  #800  
Old 04-21-2006, 10:06 AM
csidlernet csidlernet is offline
 
Join Date: Apr 2003
Location: sydney
Posts: 183
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

really cool thanks a lot
Reply With Quote
  #801  
Old 04-21-2006, 01:33 PM
Abe1's Avatar
Abe1 Abe1 is offline
 
Join Date: Feb 2004
Location: I LOVE New York!
Posts: 2,886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TomasDR
I searched the thread but all I found was one user who included a checkbox their template. But is there anyway to add a multiple choice checkbox type question?

If not, are there any plans to include that feature?

Recent Install and liking it!
I'll try to add a check box options soon.
Reply With Quote
  #802  
Old 04-22-2006, 03:44 PM
SupremeWeapon SupremeWeapon is offline
 
Join Date: Jan 2005
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so what about my issue. the form still doesnt post to a topic. and if poll is selected it still givs the error

Fatal error: Unable to proceed with save while $errors array is not empty in class vB_DataManager_PM in /includes/class_dm.php on line 758

new error

going to uninstall this hack untill these errors are addressed, it's got potential. but thats all right now. It doesnt post to forums. It errors on pm and poll
Reply With Quote
  #803  
Old 04-22-2006, 05:44 PM
goldenllama goldenllama is offline
 
Join Date: Mar 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed. Working great!

Is it possible to insert a default value in the spaces? I put a link to the form in my postbit to appear at the bottom of every post, and I'd like for one of the fields to automatically contain a link to the thread from which the user came. I think this is possible simply by nabbing the page referrer from the user's browser. I know how to do this via html, but am clueless when it comes to vB coding. Can you help me do this?
Reply With Quote
  #804  
Old 04-22-2006, 08:41 PM
jodycwilliams jodycwilliams is offline
 
Join Date: Apr 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I modified Form Hack a ton to fit exactly what we need in Everquest 2 guilds for recruiting.

Unfortunately, whenever it posts to the forum, it puts it in my signature.

Here is the Hook

PHP Code:
// To add more then one form, copy this whole text, and creat a new plug-in with the hook location 'newthread_start'.
// After, change the form name. You can't have 2 forms with the same name.

// Name of this form
$formname "Recruit";

if (
$_REQUEST['do'] == $formname)
{

// #######################################################################
// ######################## CUSTOMIZE VARIABLES ##########################
// #######################################################################

////////////////////////////////////////////////////////////////////////////////////////////////////
////// BEGIN CUSTOMIZATION BELOW////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//VARIABLES
//Study how variables are add here to add or remove any. If you add a variable to your form, you must add it to part one and part two.
////////////////////////////////////////////////////////////////////////////////////////////////////

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'normalanswer1' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'normalanswer2' => TYPE_STR,
'answer2a' => TYPE_STR,
'dropdownanswer2' => TYPE_STR,
'normalanswer3' => TYPE_STR,
'normalanswer4' => TYPE_STR,
'normalanswer5' => TYPE_STR,
'longanswer1' => TYPE_STR,
'normalanswer6' => TYPE_STR,
'dropdownanswer3' => TYPE_STR,
'longanswer2' => TYPE_STR,
'longanswer3' => TYPE_STR,
'longanswer4' => TYPE_STR,
));

// Part 2
$normalanswer1 $vbulletin->GPC['normalanswer1'];
$dropdownanswer1 $vbulletin->GPC['dropdownanswer1'];
$normalanswer2 $vbulletin->GPC['normalanswer2'];
$dropdownanswer2 $vbulletin->GPC['dropdownanswer2'];
$normalanswer3 $vbulletin->GPC['normalanswer3'];
$normalanswer4 $vbulletin->GPC['normalanswer4'];
$normalanswer5 $vbulletin->GPC['normalanswer5'];
$longanswer1 $vbulletin->GPC['longanswer1'];
$normalanswer6 $vbulletin->GPC['normalanswer6'];
$dropdownanswer3 $vbulletin->GPC['dropdownanswer3'];
$longanswer2 $vbulletin->GPC['longanswer2'];
$longanswer3 $vbulletin->GPC['longanswer3'];
$longanswer4 $vbulletin->GPC['longanswer4'];


////////////////////////////////////////////////////////////////////////////////////////////////////
//USERGROUPS ALLOWED
//You can add or remove usegroups that are ALLOWED to use this form by changing the numbers below in the array.
//To enable this feature, remove the '//' before the 'if'.
////////////////////////////////////////////////////////////////////////////////////////////////////

// if (!in_array($vbulletin->userinfo['usergroupid'], array(2,5,6,7))) print_no_permission();

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NAME OF TEMPLATES - DO THIS BIT IF YOU ARE MAKING MORE FORMS AND WANT TO USE A DIFFERENT LOOKING TEMPLATE
////////////////////////////////////////////////////////////////////////////////////////////////////

// Name of the main template
$maintemplate "form";
// Name of the answer template
$answertemplate "formanswers";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//CHOOSE WHETHER YOU WANT FORM TO BE POSTED IN A NEW THREAD, NEW POLL, REPLY TO EXISITING THREAD, PMed OR EMAILED
///////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE POSTED - 1 = yes, 0 = no
$formforum "1";

//FORUM TO POST NEW THREAD IN
//You CAN make this number a variable. You can have a drop down menu or in the link like do=form&f=1. Make sure you add it the variables list.

$formforumid "15";

//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll "0";
$polloption[1] = "Yes";
$polloption[2] = "No";
$polloption[3] = "Maybe";

//Make poll public - 1 = yes, 0 = no
$pollpublic "0";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO REPLY TO EXISTING THREAD - 1 = yes, 0 = no
$formreply "0";

//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid "12345";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE PMED (guests CANNOT use this option) - 1 = yes, 0 = no
$formpm "0";

//USERNAME TO PM TO
$formpmname "Abe";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE EMAILED - 1 = yes, 0 = no
$formemail "1";

//EMAIL ADDRESS TO EMAIL TO
$formemailaddress "jodycwilliams@hotmail.com";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//REDIRECT OPTIONS:
// 0 - thank you message (thread, reply, pm, or email)
// 1 - redirect to post (thread or reply)
// 2 - redirect to thread (thread only)
// 3 - redirect to forum (thread only)
// 4 - redirect to editpost to upload attachments (thread or reply)
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption "1";

$errormessage "Thank you for submitting this form!"//This is the thank you message

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
//If you added or deleted variables, you must edit what it checked for. Search for "$answerall ==" and edit 2 lines under it.
////////////////////////////////////////////////////////////////////////////////////////////////////

$answerall "0";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error, besides the quotes around the whole title)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle "Recruit Application";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF THREAD/POST/PM/EMAIL (do not use quotation marks in the title or you will get a parse error)
//You may use variables from the form for this.
////////////////////////////////////////////////////////////////////////////////////////////////////

$posttitle "APPLICATION - $normalanswer1 $normalanswer2 $dropdownanswer1 from $dropdownanswer2";

////////////////////////////////////////////////////////////////////////////////////////////////////
//PURPOSE OF FORM (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formpurpose "The purpose of this form is to submit an application for recruitment to Amend.";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//Begin Questions
////////////////////////////////////////////////////////////////////////////////////////////////////

//Character Name

$normalquestion1 "What is your character name?";

//Class Question

$dropdownquestion1 "What is your class?";

// The following choices must NOT have quotation marks
$dropdownchoice1a "Guardian";
$dropdownchoice1b "Berserker";
$dropdownchoice1c "Bruiser";
$dropdownchoice1d "Monk";
$dropdownchoice1e "Shadow Knight";
$dropdownchoice1f "Paladin";
$dropdownchoice1g "Inquisitor";
$dropdownchoice1h "Templar";
$dropdownchoice1i "Fury";
$dropdownchoice1j "Warden";
$dropdownchoice1k "Defiler";
$dropdownchoice1l "Mystic";
$dropdownchoice1m "Warlock";
$dropdownchoice1n "Wizard";
$dropdownchoice1o "Coercer";
$dropdownchoice1p "Illusionist";
$dropdownchoice1q "Necromancer";
$dropdownchoice1r "Conjuror";
$dropdownchoice1s "Assassin";
$dropdownchoice1t "Ranger";
$dropdownchoice1u "Brigand";
$dropdownchoice1v "Swashbuckler";
$dropdownchoice1w "Dirge";
$dropdownchoice1x "Troubador";

//Level Question

$normalquestion2 "What is your level?";

//AA Question

$normalquestion3 "How many AA do you currently have?";

//Server Question - No PVP or SE Servers are Listed

$dropdownquestion2 "What server does your character currently reside on?";

// The following choices must NOT have quotation marks
$dropdownchoice2a "Antonia Bayle";
$dropdownchoice2b "Befallen";
$dropdownchoice2c "Blackburrow";
$dropdownchoice2d "Butcherblock";
$dropdownchoice2e "Crushbone";
$dropdownchoice2f "Everfrost";
$dropdownchoice2g "Guk";
$dropdownchoice2h "Innovation";
$dropdownchoice2i "Kithicor";
$dropdownchoice2j "Lucan D'Lere";
$dropdownchoice2k "Mistmoore";
$dropdownchoice2l "Najena";
$dropdownchoice2m "Nektulos";
$dropdownchoice2n "Oasis";
$dropdownchoice2o "Permafrost";
$dropdownchoice2p "Runnyeye";
$dropdownchoice2q "Splitpaw";
$dropdownchoice2r "Storms";
$dropdownchoice2s "Unrest";
$dropdownchoice2t "Valor";
$dropdownchoice2u "Veksar";

//Creation Date Quesiton

$normalquestion4 "What is your character's Creation Date?";

//Playtime Question

$normalquestion5 "What is your character's total /play time?";

//Previous MMO Experience Question

$longquestion1 "Please describe any prior MMO experience.";

//Computer Question

$longquestion2 "Describe your computer's configuration.";

//Internet Connection Question

$dropdownquestion3 "What type of Internet Connection do you have?";

// The following choices must NOT have quotation marks
$dropdownchoice3a "Dial Up";
$dropdownchoice3b "Satellite";
$dropdownchoice3c "Cable/DSL";
$dropdownchoice3d "T1+";

//Teamspeak Prepared Question

$normalquestion6 "Do you have Teamspeak installed and own a Mic and Speakers/Headset?";

//Previous 3 Guilds Question

$longquestion3 "List your previous guilds (3 max).";

//Brief Bio

$longquestion4 "Please type in a brief bio.";


////////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////
//
//$radioquestion3 = "Is it yes or no? If yes, please elaborate";
//
// The following choices must NOT have quotation marks
//$radiochoice3a = "yes";
//$radiochoice3b = "no";
//
////////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
//$question1 = "What is your 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 is your email?";
//$explain2 = "Please enter your real email here.";
//
//QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
//$question3 = "What is your website?";
//$explain3 = "Please enter your URL here.";
//
////////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////////
//DROP DOWN CHOICES : QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
////////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////////
//LONG TEXT AREA INPUT: QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////
//
//$longquestion1 = "Please write down a paragraph about yourself.";
//$longexplain1 = "For example, a bit about your experience in this area.";
//
////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//VB TEXT AREA INPUT: You can only have ONE vb text question. (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

//$vbtextquestion = "Please write down a paragraph about how you like this forum.";
//$vbtextexplain = "For example, what makes this forum different from all other forums?";

////////////////////////////////////////////////////////////////////////////////////////////////
////// END OF CUSTOMIZATION ////////////////////////////////////////////////////////////////////
/////  DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!!! ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if ($_REQUEST['action'] == '')
{
  
$_REQUEST['action'] = "form";
}


$bbuserinfo $vbulletin->userinfo;

// start navbar
$navbits = array();
$navbits['newthread.php?' $vbulletin->session->vars['sessionurl'] . "do=$formname"] = $formtitle;

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');

if (
$_REQUEST['action'] == "submit")
{

    if (
$answerall == "1")
    {
        if (
$normalanswer1 == '' OR $normalanswer2 == '' OR $normalanswer3 == '' OR $normalanswer4 == '' OR $normalanswer5 == '' OR $normalanswer6 == '' OR $dropdownanswer1 == '' OR $dropdownanswer2 == '' OR $dropdownanswer3 == '' OR $longanswer1 == '' OR $longanswer2 == '' OR $longanswer3 == '' OR $longanswer4 == '')
        {
            
$errormessage "$bbuserinfo[username], you need to answer every question!";
            eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");');
            exit();
        }
    }

    
$vbulletin->input->clean_array_gpc('p', array(
        
'wysiwyg'            => TYPE_BOOL,
        
'message'            => TYPE_STR
        
));

    if (
$vbulletin->GPC['wysiwyg'])
    {
        require_once(
DIR '/includes/functions_wysiwyg.php');
        
$vbtextanswer convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $foruminfo['allowhtml']);
    }
    else
    {
        
$vbtextanswer =& $vbulletin->GPC['message'];
    }

    eval(
'$formsend = "' fetch_template("$answertemplate") . '";');

    if (
$_POST['submit'] == 'Submit')
    {
        if (
$formforum == "1")
        {
            
$foruminfo verify_id('forum'$formforumid01);
            
$forumperms fetch_permissions($foruminfo[forumid]);
            
$newpost['username'] =& $vbulletin->userinfo['username'];
            
$newpost['message'] =& $formsend;
            
$newpost['title'] =& $posttitle;
            
$newpost['parseurl'] = '1';

            if (
$vbulletin->userinfo['autosubscribe'] != -1)
            {
                
$newpost['emailupdate'] = $vbulletin->userinfo['autosubscribe'];
            }
            else
            {
                
$newpost['emailupdate'] = 9999;
            }

            if (
$vbulletin->userinfo['signature'] != '')
            {
                
$newpost['signature'] = '1';
            }
            else
            {
                
$newpost['signature'] = '0';
            }

            
build_new_post('thread'$foruminfo, array(), array(), $newpost$errors);

            if (
$formpoll == "1")
            {
                
$threadinfo verify_id('thread'$newpost[threadid], 01);
                
$polloptions count($polloption);
                
$question $posttitle;
                
$vbulletin->GPC['options'] = $polloption;

                
$counter 0;
                
$optioncount 0;
                
$badoption '';
                while (
$counter++ < $polloptions)
                { 
// 0..Pollnum-1 we want, as arrays start with 0
                    
if ($vbulletin->options['maxpolllength'] AND vbstrlen($vbulletin->GPC['options']["$counter"]) > $vbulletin->options['maxpolllength'])
                    {
                        
$badoption .= iif($badoption', ') . $counter;
                    }
                    if (!empty(
$vbulletin->GPC['options']["$counter"]))
                    {
                        
$optioncount++;
                    }
                }

                
// Add the poll
                
$poll =& datamanager_init('Poll'$vbulletinERRTYPE_STANDARD);

                
$counter 0;
                while (
$counter++ < $polloptions)
                {
                    if (
$vbulletin->GPC['options']["$counter"] != '')
                    {
                        
$poll->set_option($vbulletin->GPC['options']["$counter"]);
                    }
                }

                
$poll->set('question',    $question);
                
$poll->set('dateline',    TIMENOW);
                
$poll->set('active',    '1');
                
$poll->set('public',    $pollpublic);

                
$pollid $poll->save();
                
//end create new poll

                // update thread
                
$threadman =& datamanager_init('Thread'$vbulletinERRTYPE_STANDARD'threadpost');
                
$threadman->set_existing($threadinfo);
                
$threadman->set('pollid'$pollid);
                
$threadman->save();
            }
        }

        if (
$formreply == "1")
        {
            
$threadinfo verify_id('thread'$formreplythreadid01);
            
$forumperms fetch_permissions($threadinfo[forumid]);
            
$newpost['username'] =& $vbulletin->userinfo['username'];
            
$newpost['message'] =& $formsend;
            
$newpost['title'] =& $posttitle;
            
$newpost['parseurl'] = "1";
        
            if (
$vbulletin->userinfo['autosubscribe'] != -1)
            {
                
$newpost['emailupdate'] = $vbulletin->userinfo['autosubscribe'];
            }
            else
            {
                
$newpost['emailupdate'] = 9999;
            }

            if (
$vbulletin->userinfo['signature'] != '')
            {
                
$newpost['signature'] = '1';
            }
            else
            {
                
$newpost['signature'] = '0';
            }

            
build_new_post('reply'$foruminfo$threadinfo$postinfo$newpost$errors);
        }

        if (
$formpm == "1")
        {
            
$vbulletin->GPC['message'] =& $formsend;
            
$vbulletin->GPC['title'] =& $posttitle;
            
$vbulletin->GPC['recipients'] =& $formpmname;

            
$pm['message'] =& $vbulletin->GPC['message'];
            
$pm['title'] =& $vbulletin->GPC['title'];
            
$pm['recipients'] =& $vbulletin->GPC['recipients'];

            
// create the DM to do error checking and insert the new PM
            
$pmdm =& datamanager_init('PM'$vbulletinERRTYPE_ARRAY);

            
$pmdm->set('fromuserid'$vbulletin->userinfo['userid']);
            
$pmdm->set('fromusername'$vbulletin->userinfo['username']);
            
$pmdm->setr('title'$pm['title']);
            
$pmdm->setr('message'$pm['message']);
            
$pmdm->set_recipients($pm['recipients'], $permissions);
            
$pmdm->set('dateline'TIMENOW);

            
// everything's good!
            
$pmdm->save();
        }

        if (
$formemail == "1")
        {
            
vbmail($formemailaddress$posttitle$formsend);
        }

        if (
$redirectoption == "1")
        {
            
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]";
            eval(
print_standard_redirect('redirect_postthanks'));
            exit();
        }
        if (
$redirectoption == "2")
        {
            
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "t=$newpost[threadid]";
            eval(
print_standard_redirect('redirect_postthanks'));
            exit();
        }
        if (
$redirectoption == "3")
        {
            
$vbulletin->url 'forumdisplay.php?' $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]";
            eval(
print_standard_redirect('redirect_postthanks'));
            exit();
        }
        if (
$redirectoption == "4")
        {
            
$vbulletin->url 'editpost.php?do=editpost&' $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]";
            eval(
print_standard_redirect('redirect_postthanks'));
            exit();
        }
        eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");');
        exit();
    }
    else
    {
          require_once(
'./includes/class_bbcode.php');
        
$parser =& new vB_BbCodeParser($vbulletinfetch_tag_list());
        
$preview $parser->do_parse($formsend);

        
$_REQUEST['action'] = 'form';
    }
}

if (
$_REQUEST['action'] == 'form')
{
    
// set message box width to usercp size
    
$stylevar['messagewidth'] = $stylevar['messagewidth_usercp'];
    
$editorid construct_edit_toolbar($vbtextanswer);

    eval(
'print_output("' fetch_template("$maintemplate") . '");');
}

Here is the submission template

HTML Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle] - $formtitle</title>
</head>
<body>
$header
$navbar

<!-- main -->
<if condition="$preview">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">
		Preview
	</td>
</tr>
<tr>
	<td class="alt1">
$preview
</td>
</tr>
</table>
</if>

<br />
<form name="vbform" action="newthread.php" method="post"<if condition="!is_browser('webtv')"> onsubmit="return vB_Editor['$editorid'].prepare_submit(0, $vboptions[postminchars])"</if>>
<input type="hidden" value="$formname" name="do" />
<input type="hidden" value="submit" name="action" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat" colspan="3">
		$vboptions[bbtitle] - $formtitle
	</td>
</tr>
<tr>
	<td class="panelsurround" align="center" colspan="3">

	<table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
	<tr>
		<td align="$stylevar[left]">
			<fieldset class="fieldset" style="margin:0px">
				<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
				<tr>
					<td>
						$formpurpose

					</td>
				</tr>
		</table>
	</fieldset>
</td>
</tr>
</table>
</td>
</tr>
<tr>
	<td class="alt1" colspan="3">
				<b>$normalquestion1</b>
		</td>
	</tr>
<tr>
<td class="alt2" colspan="3">
<input type="text" size="30" value="$normalanswer1" name="normalanswer1" />
</td>
</tr>
<tr>
<td class="alt1" colspan="2">
<b>$dropdownquestion1</b>:
</td>
<td class="alt1" colspan="2">
<select name="dropdownanswer1">
<option value="$dropdownchoice1a" <if condition="$dropdownchoice1a == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1a</option>
<option value="$dropdownchoice1b" <if condition="$dropdownchoice1b == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1b</option>
<option value="$dropdownchoice1c" <if condition="$dropdownchoice1c == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1c</option>
<option value="$dropdownchoice1d" <if condition="$dropdownchoice1d == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1d</option>
<option value="$dropdownchoice1e" <if condition="$dropdownchoice1e == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1e</option>
<option value="$dropdownchoice1f" <if condition="$dropdownchoice1f == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1f</option>
<option value="$dropdownchoice1g" <if condition="$dropdownchoice1g == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1g</option>
<option value="$dropdownchoice1h" <if condition="$dropdownchoice1h == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1h</option>
<option value="$dropdownchoice1i" <if condition="$dropdownchoice1i == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1i</option>
<option value="$dropdownchoice1j" <if condition="$dropdownchoice1j == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1j</option>
<option value="$dropdownchoice1k" <if condition="$dropdownchoice1k == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1k</option>
<option value="$dropdownchoice1l" <if condition="$dropdownchoice1l == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1l</option>
<option value="$dropdownchoice1m" <if condition="$dropdownchoice1m == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1m</option>
<option value="$dropdownchoice1n" <if condition="$dropdownchoice1n == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1n</option>
<option value="$dropdownchoice1o" <if condition="$dropdownchoice1o == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1o</option>
<option value="$dropdownchoice1p" <if condition="$dropdownchoice1p == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1p</option>
<option value="$dropdownchoice1q" <if condition="$dropdownchoice1q == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1q</option>
<option value="$dropdownchoice1r" <if condition="$dropdownchoice1r == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1r</option>
<option value="$dropdownchoice1s" <if condition="$dropdownchoice1s == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1s</option>
<option value="$dropdownchoice1t" <if condition="$dropdownchoice1t == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1t</option>
<option value="$dropdownchoice1u" <if condition="$dropdownchoice1u == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1u</option>
<option value="$dropdownchoice1v" <if condition="$dropdownchoice1v == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1v</option>
<option value="$dropdownchoice1w" <if condition="$dropdownchoice1w == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1w</option>
<option value="$dropdownchoice1x" <if condition="$dropdownchoice1x == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1x</option>
</select></td>
</tr>
<tr>
	<td class="alt1" colspan="2">
				<b>$normalquestion2</b>
		</td>
	<td class="alt1" colspan="2">
				<b>$normalquestion3</b>
	</td>	
	</tr>
<tr>
<td class="alt1" colspan="2">
<input type="text" size="30" value="$normalanswer2" name="normalanswer2" />
</td>
<td class="alt1" colspan="2">
<input type="text" size="30" value="$normalanswer3" name="normalanswer3" />
</td>
</tr>
<tr>
<td class="alt1" colspan="2">
<b>$dropdownquestion2</b>:
</td>
<td class="alt1" colspan="2">
<select name="dropdownanswer2">
<option value="$dropdownchoice2a" <if condition="$dropdownchoice2a == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2a</option>
<option value="$dropdownchoice2b" <if condition="$dropdownchoice2b == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2b</option>
<option value="$dropdownchoice2c" <if condition="$dropdownchoice2c == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2c</option>
<option value="$dropdownchoice2d" <if condition="$dropdownchoice2d == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2d</option>
<option value="$dropdownchoice2e" <if condition="$dropdownchoice2e == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2e</option>
<option value="$dropdownchoice2f" <if condition="$dropdownchoice2f == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2f</option>
<option value="$dropdownchoice2g" <if condition="$dropdownchoice2g == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2g</option>
<option value="$dropdownchoice2h" <if condition="$dropdownchoice2h == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2h</option>
<option value="$dropdownchoice2i" <if condition="$dropdownchoice2i == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2i</option>
<option value="$dropdownchoice2j" <if condition="$dropdownchoice2j == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2j</option>
<option value="$dropdownchoice2k" <if condition="$dropdownchoice2k == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2k</option>
<option value="$dropdownchoice2l" <if condition="$dropdownchoice2l == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2l</option>
<option value="$dropdownchoice2m" <if condition="$dropdownchoice2m == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2m</option>
<option value="$dropdownchoice2n" <if condition="$dropdownchoice2n == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2n</option>
<option value="$dropdownchoice2o" <if condition="$dropdownchoice2o == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2o</option>
<option value="$dropdownchoice2p" <if condition="$dropdownchoice2p == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2p</option>
<option value="$dropdownchoice2q" <if condition="$dropdownchoice2q == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2q</option>
<option value="$dropdownchoice2r" <if condition="$dropdownchoice2r == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2r</option>
<option value="$dropdownchoice2s" <if condition="$dropdownchoice2s == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2s</option>
<option value="$dropdownchoice2t" <if condition="$dropdownchoice2t == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2t</option>
<option value="$dropdownchoice2u" <if condition="$dropdownchoice2u == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2u</option>
</select></td>
</tr>
<tr>
	<td class="alt1" colspan="2">
				<b>$normalquestion4</b>
		</td>
	<td class="alt1" colspan="2">
				<b>$normalquestion5</b>
	</td>	
</tr>
<tr>
	<td class="alt1" colspan="2">
			<input type="text" size="30" value="$normalanswer4" name="normalanswer4" />
		</td>
	<td class="alt1" colspan="2">
			<input type="text" size="30" value="$normalanswer5" name="normalanswer5" />
		</td>
</tr>	
<tr>
	<td class="alt2" colspan="2">
		<b>$longquestion1</b><br />
		$longexplain1</td>
	<td class="alt2" colspan="2">
		<textarea rows="8" cols="50" name="longanswer1">$longanswer1</textarea>
	</td>
</tr>
<tr>
	<td class="alt2" colspan="2">
		<b>$longquestion2</b><br />
		$longexplain2</td>
	<td class="alt2" colspan="2">
		<textarea rows="8" cols="50" name="longanswer2">$longanswer2</textarea>
	</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
		<b>$dropdownquestion3</b>:
	</td>
	<td class="alt1" colspan="3">
		<select name="dropdownanswer3">
		<option value="$dropdownchoice3a" <if condition="$dropdownchoice3a == $dropdownanswer3">selected="selected"</if>>$dropdownchoice3a</option>
		<option value="$dropdownchoice3b" <if condition="$dropdownchoice3b == $dropdownanswer3">selected="selected"</if>>$dropdownchoice3b</option>
		<option value="$dropdownchoice3c" <if condition="$dropdownchoice3c == $dropdownanswer3">selected="selected"</if>>$dropdownchoice3c</option>
		<option value="$dropdownchoice3d" <if condition="$dropdownchoice3d == $dropdownanswer3">selected="selected"</if>>$dropdownchoice3d</option>
	</select></td>
</tr>
<tr>
	<td class="alt1" colspan="2">
			<b>$normalquestion6</b>
		</td>
	<td class="alt1" colspan="2">
			<b>$longquestion3</b>
		</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
			<input type="text" size="30" value="$normalanswer6" name="normalanswer6" />
			</td>
	<td class="alt2" colspan="2">
			<textarea rows="3" cols="50" name="longanswer3">$longanswer3</textarea>
		</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
			<b>$longquestion4</b>
		</td>
	<td class="alt2" colspan="2">
			<textarea rows="5" cols="50" name="longanswer4">$longanswer4</textarea>
		</td>
</tr>
<tr>
<td valign="top" colspan="3">
<p align="center">
<input type="submit" value="Submit" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="submit" value="Preview" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="reset" value="Reset" name="reset" style="font-family: Verdana; font-size: 10pt" class="button" />
</p></td></tr>
</table>

</form>

$footer
</body>
</html>
And here is the answer template I made

HTML Code:
<table>
<tr>
	<td class="alt1" colspan="3">
				<b>$normalquestion1</b>
		</td>
	</tr>
<tr>
<td class="alt2" colspan="3">
$normalanswer1
</td>
</tr>
<tr>
<td class="alt1" colspan="2">
<b>$dropdownquestion1</b>:
</td>
<td class="alt1" colspan="2">
$dropdownanswer1
</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
				<b>$normalquestion2</b>
		</td>
	<td class="alt1" colspan="2">
				<b>$normalquestion3</b>
	</td>	
	</tr>
<tr>
<td class="alt1" colspan="2">
$normalanswer2
</td>
<td class="alt1" colspan="2">
$normalanswer3
</td>
</tr>
<tr>
<td class="alt1" colspan="2">
<b>$dropdownquestion2</b>:
</td>
<td class="alt1" colspan="2">
$dropdownanswer2
</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
		<b>$normalquestion4</b>
		</td>
	<td class="alt1" colspan="2">
		<b>$normalquestion5</b>
	</td>	
</tr>
<tr>
	<td class="alt1" colspan="2">
	        $normalanswer4
		</td>
	<td class="alt1" colspan="2">
		$normalanswer5
		</td>
</tr>	
<tr>
	<td class="alt2" colspan="2">
		<b>$longquestion1</b><br />
		$longexplain1</td>
	<td class="alt2" colspan="2">
		$longanswer1
	</td>
</tr>
<tr>
	<td class="alt2" colspan="2">
		<b>$longquestion2</b><br />
		$longexplain2</td>
	<td class="alt2" colspan="2">
                $longanswer2
	</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
		<b>$dropdownquestion3</b>:
	</td>
	<td class="alt1" colspan="3">
		$dropdownanswer3
</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
		<b>$normalquestion6</b>
	</td>
	<td class="alt1" colspan="2">
		<b>$longquestion3</b>
	</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
	        $normalanswer6	
	</td>
	<td class="alt2" colspan="2">
	        $longanswer3
	</td>
</tr>
<tr>
	<td class="alt1" colspan="2">
		<b>$longquestion4</b>
	</td>
	<td class="alt2" colspan="2">
	       	$longanswer4	
	</td>
</tr>
Any help would be great!

You can see my form at http://www.amend-eq2.com/forums/newt...php?do=Recruit

If I could just fix this one, small issue, I'd be in love with this hack. Great work bud.
Reply With Quote
  #805  
Old 04-22-2006, 08:46 PM
Crazy Serb Crazy Serb is offline
 
Join Date: Mar 2005
Posts: 119
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by wolfstream
This looks good, like just what I've been looking for, actually. A couple of questions/ problems though.
Firstly:
I'm trying to get the form data to parse a very simple url, like:
http://www.domain.com/newthread.php?...&review=myhost
The idea is to have that last bit be part of the title itself. Code changed for this:
Code:
$formtitle = "Generic Form for $review";
which simply returns
Forumname : Generic form for
Am I missing something here? Do I need to add something to parse the review bit?

Secondly, can this parse sql queries directly? Instead of handing them off to a forum, what I'm looking to do is add them to a db of reviews which will then be approved by an admin, and viewed by the end user, not in a forum as it were.
I am wondering if that is possible as well...


Also, if I don't want to enable this form to be a part of any NEW THREAD options (instead I wanna use it as a reply to an existing thread), do I just set $formforumid = "0"?
Reply With Quote
  #806  
Old 04-22-2006, 08:55 PM
jodycwilliams jodycwilliams is offline
 
Join Date: Apr 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hehe, forgot to put a
HTML Code:
</table>
at the end of the answer template.

Got that sucker straightened out.


Amazingly good hack, bud.
Reply With Quote
  #807  
Old 04-22-2006, 08:57 PM
Crazy Serb Crazy Serb is offline
 
Join Date: Mar 2005
Posts: 119
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

also, is it possible to add an option of inserting some of the members' profile fields into the form?

I have a first/last name custom field in members' profile, and was wondering if I could insert it (in case it has been filled out by a member) into one of the answers automatically... or even the email field, that would be one of the questions on my form, so inserting it automatically would be awesome!
Reply With Quote
  #808  
Old 04-22-2006, 09:08 PM
jodycwilliams jodycwilliams is offline
 
Join Date: Apr 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bleh, after all that work I still need a little help.

I'm very new to all of this, so please humor me.

How would I take that link: http://www.amend-eq2.com/forums/newt...php?do=Recruit and turn it into a page inside of vBadvanced? Anyone know by chance?
Reply With Quote
  #809  
Old 04-22-2006, 09:48 PM
Crazy Serb Crazy Serb is offline
 
Join Date: Mar 2005
Posts: 119
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by bhxtyrant
Hey guys,I was wondering is there a way to intergrate this with vBadvanced CMPS?
has this been figured out yet... if not, I second this one!
Reply With Quote
  #810  
Old 04-22-2006, 09:55 PM
jodycwilliams jodycwilliams is offline
 
Join Date: Apr 2006
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So far, all I could do was add it to the site navigation module, but yeah, I'd like it integrated. That'd be perfect!
Reply With Quote
  #811  
Old 04-22-2006, 10:13 PM
Crazy Serb Crazy Serb is offline
 
Join Date: Mar 2005
Posts: 119
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how did you add the navigation module?

and btw, I am not receiving an email confirmation of this (I changed my email in the newthread_start template to my working email) plus I am getting this error message as well:

Warning: Cannot use a scalar value as an array in /includes/functions_newpost.php on line 329


can you guys figure out what am I doing wrong here?

here are my templates:

newthread_start:
Code:
// To add more then one form, copy this whole text, and create a new plug-in with the hook location 'newthread_start'.
// After, change the form name. You can't have 2 forms with the same name.

// Name of this form
$formname = "gallery";

if ($_REQUEST['do'] == $formname)
{

// #######################################################################
// ######################## CUSTOMIZE VARIABLES ##########################
// #######################################################################

////////////////////////////////////////////////////////////////////////////////////////////////////
////// BEGIN CUSTOMIZATION BELOW////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//VARIABLES
//Study how variables are added here to add or remove any. If you add a variable to your form, you must add it to part one and part two.
////////////////////////////////////////////////////////////////////////////////////////////////////

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'normalanswer1' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'normalanswer2' => TYPE_STR
));

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$normalanswer2 = $vbulletin->GPC['normalanswer2'];

////////////////////////////////////////////////////////////////////////////////////////////////////
//USERGROUPS ALLOWED
//You can add or remove usegroups that are ALLOWED to use this form by changing the numbers below in the array.
//To enable this feature, remove the '//' before the 'if'.
////////////////////////////////////////////////////////////////////////////////////////////////////

if (!in_array($vbulletin->userinfo['usergroupid'], array(2,5,6))) print_no_permission();

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NAME OF TEMPLATES - DO THIS BIT IF YOU ARE MAKING MORE FORMS AND WANT TO USE A DIFFERENT LOOKING TEMPLATE
////////////////////////////////////////////////////////////////////////////////////////////////////

// Name of the main template
$maintemplate = "form";
// Name of the answer template
$answertemplate = "formanswers";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//CHOOSE WHETHER YOU WANT FORM TO BE POSTED IN A NEW THREAD, NEW POLL, REPLY TO EXISITING THREAD, PMed OR EMAILED
///////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE POSTED - 1 = yes, 0 = no
$formforum = "1";

//FORUM TO POST NEW THREAD IN
//You CAN make this number a variable. You can have a drop down menu or in the link like do=form&f=1. Make sure you add it the variables list.
$formforumid = "0";

//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll = "0";
$polloption[1] = "Yes";
$polloption[2] = "No";
$polloption[3] = "Maybe";

//Make poll public - 1 = yes, 0 = no
$pollpublic = "0";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO REPLY TO EXISTING THREAD - 1 = yes, 0 = no
$formreply = "1";

//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid = "4529";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE PMED (guests CANNOT use this option) - 1 = yes, 0 = no
$formpm = "0";

//USERNAME TO PM TO
$formpmname = "Abe";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE EMAILED - 1 = yes, 0 = no
$formemail = "1";

//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "my@email.com";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//REDIRECT OPTIONS:
// 0 - thank you message (thread, reply, pm, or email)
// 1 - redirect to post (thread or reply)
// 2 - redirect to thread (thread only)
// 3 - redirect to forum (thread only)
// 4 - redirect to editpost to upload attachments (thread or reply)
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption = "0";

$errormessage = "Thank you for submitting your Guestlist request. Your will receive a confirmation from the Promoter for this event as soon as your request has been processed."; //This is the thank you message

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
//If you added or deleted variables, you must edit what it checked for. Search for "$answerall ==" and edit 2 lines under it.
////////////////////////////////////////////////////////////////////////////////////////////////////

$answerall = "1";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error, besides the quotes around the whole title)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "GuestList Form";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF THREAD/POST/PM/EMAIL (do not use quotation marks in the title or you will get a parse error)
//You may use variables from the form for this.
////////////////////////////////////////////////////////////////////////////////////////////////////

$posttitle = "$formtitle";

////////////////////////////////////////////////////////////////////////////////////////////////////
//PURPOSE OF FORM (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formpurpose = "REQUESTS ACCEPTED UNTIL: 8:00 PM ON THE DAY OF THIS EVENT<br />GUESTLIST INCLUDES: Line Bypass | Limited Reduced & Free Cover Passes Available<br />GUESTLIST CLOSES AT: 12:00 AM SHARP<br />DRESS CODE: Style Code<br />YOU MUST BE 19+ YEARS OF AGE TO ATTEND";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion1 = "Your Name: ";
$normalquestion2 = "Your E-mail: ";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

//$radioquestion1 = "Choose one of the following choices";

// The following choices must NOT have quotation marks
//$radiochoice1a = "yes";
//$radiochoice1b = "no";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 2 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

//$radioquestion2 = "Choose another one of the following choices";

// The following choices must NOT have quotation marks
//$radiochoice2a = "good";
//$radiochoice2b = "bad";
//$radiochoice2c = "both";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

//$radioquestion3 = "Is it yes or no? If yes, please elaborate";

// The following choices must NOT have quotation marks
//$radiochoice3a = "yes";
//$radiochoice3b = "no";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question1 = "What is your 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 is your email?";
$explain2 = "Please enter your real email here.";

//QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question3 = "What is your website?";
$explain3 = "Please enter your URL here.";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//DROP DOWN CHOICES : QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

$dropdownquestion1 = "How many guests are you bringing?";

// The following choices must NOT have quotation marks
$dropdownchoice1a = "1";
$dropdownchoice1b = "2";
$dropdownchoice1c = "3";
$dropdownchoice1d = "4";
$dropdownchoice1e = "5";
$dropdownchoice1f = "6";
$dropdownchoice1g = "7";
$dropdownchoice1h = "8";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//LONG TEXT AREA INPUT: QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

//$longquestion1 = "Please write down a paragraph about yourself.";
//$longexplain1 = "For example, a bit about your experience in this area.";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//VB TEXT AREA INPUT: You can only have ONE vb text question. (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
////////////////////////////////////////////////////////////////////////////////////////////////////

//$vbtextquestion = "Please write down a paragraph about how you like this forum.";
//$vbtextexplain = "For example, what makes this forum different from all other forums?";

////////////////////////////////////////////////////////////////////////////////////////////////
////// END OF CUSTOMIZATION ////////////////////////////////////////////////////////////////////
/////  DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!!! ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if ($_REQUEST['action'] == '')
{
  $_REQUEST['action'] = "gallery";
}


$bbuserinfo = $vbulletin->userinfo;

// start navbar
$navbits = array();
$navbits['newthread.php?' . $vbulletin->session->vars['sessionurl'] . "do=$formname"] = $formtitle;

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

if ($_REQUEST['action'] == "submit")
{

    if ($answerall == "1")
    {
        if ($normalanswer1 == '' OR $dropdownanswer1 == '' OR $normalanswer2 == '')
        {
            $errormessage = "$bbuserinfo[username], you need to fill out all the fields!";
            eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
            exit();
        }
    }

	$vbulletin->input->clean_array_gpc('p', array(
		'wysiwyg'			=> TYPE_BOOL,
		'message'			=> TYPE_STR
		));

	if ($vbulletin->GPC['wysiwyg'])
	{
		require_once(DIR . '/includes/functions_wysiwyg.php');
		$vbtextanswer = convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $foruminfo['allowhtml']);
	}
	else
	{
		$vbtextanswer =& $vbulletin->GPC['message'];
	}

    eval('$formsend = "' . fetch_template("$answertemplate") . '";');

	if ($_POST['submit'] == 'Submit')
	{
		if ($formforum == "1")
    	{
        	$foruminfo = verify_id('forum', $formforumid, 0, 1);
        	$forumperms = fetch_permissions($foruminfo[forumid]);
        	$newpost['username'] =& $vbulletin->userinfo['username'];
        	$newpost['message'] =& $formsend;
        	$newpost['title'] =& $posttitle;
        	$newpost['parseurl'] = '1';

			if ($vbulletin->userinfo['autosubscribe'] != -1)
			{
				$newpost['emailupdate'] = $vbulletin->userinfo['autosubscribe'];
			}
			else
			{
				$newpost['emailupdate'] = 9999;
			}

			if ($vbulletin->userinfo['signature'] != '')
			{
				$newpost['signature'] = '1';
			}
			else
			{
				$newpost['signature'] = '0';
			}

    		build_new_post('thread', $foruminfo, array(), array(), $newpost, $errors);

        	if ($formpoll == "1")
        	{
            	$threadinfo = verify_id('thread', $newpost[threadid], 0, 1);
            	$polloptions = count($polloption);
            	$question = $posttitle;
            	$vbulletin->GPC['options'] = $polloption;

            	$counter = 0;
            	$optioncount = 0;
            	$badoption = '';
            	while ($counter++ < $polloptions)
            	{ // 0..Pollnum-1 we want, as arrays start with 0
                	if ($vbulletin->options['maxpolllength'] AND vbstrlen($vbulletin->GPC['options']["$counter"]) > $vbulletin->options['maxpolllength'])
                	{
                    	$badoption .= iif($badoption, ', ') . $counter;
                	}
                	if (!empty($vbulletin->GPC['options']["$counter"]))
                	{
                    	$optioncount++;
                	}
            	}

            	// Add the poll
            	$poll =& datamanager_init('Poll', $vbulletin, ERRTYPE_STANDARD);

            	$counter = 0;
            	while ($counter++ < $polloptions)
            	{
                	if ($vbulletin->GPC['options']["$counter"] != '')
                	{
                    	$poll->set_option($vbulletin->GPC['options']["$counter"]);
                	}
            	}

            	$poll->set('question',	$question);
            	$poll->set('dateline',	TIMENOW);
            	$poll->set('active',	'1');
            	$poll->set('public',	$pollpublic);

            	$pollid = $poll->save();
            	//end create new poll

            	// update thread
            	$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
            	$threadman->set_existing($threadinfo);
            	$threadman->set('pollid', $pollid);
            	$threadman->save();
			}
    	}

    	if ($formreply == "1")
    	{
        	$threadinfo = verify_id('thread', $formreplythreadid, 0, 1);
        	$forumperms = fetch_permissions($threadinfo[forumid]);
        	$newpost['username'] =& $vbulletin->userinfo['username'];
        	$newpost['message'] =& $formsend;
        	$newpost['title'] =& $posttitle;
        	$newpost['parseurl'] = "1";
        
			if ($vbulletin->userinfo['autosubscribe'] != -1)
			{
				$newpost['emailupdate'] = $vbulletin->userinfo['autosubscribe'];
			}
			else
			{
				$newpost['emailupdate'] = 9999;
			}

			if ($vbulletin->userinfo['signature'] != '')
			{
				$newpost['signature'] = '1';
			}
			else
			{
				$newpost['signature'] = '0';
			}

        	build_new_post('reply', $foruminfo, $threadinfo, $postinfo, $newpost, $errors);
    	}

    	if ($formpm == "1")
    	{
        	$vbulletin->GPC['message'] =& $formsend;
        	$vbulletin->GPC['title'] =& $posttitle;
        	$vbulletin->GPC['recipients'] =& $formpmname;

        	$pm['message'] =& $vbulletin->GPC['message'];
        	$pm['title'] =& $vbulletin->GPC['title'];
        	$pm['recipients'] =& $vbulletin->GPC['recipients'];

        	// create the DM to do error checking and insert the new PM
        	$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);

        	$pmdm->set('fromuserid', $vbulletin->userinfo['userid']);
        	$pmdm->set('fromusername', $vbulletin->userinfo['username']);
        	$pmdm->setr('title', $pm['title']);
        	$pmdm->setr('message', $pm['message']);
        	$pmdm->set_recipients($pm['recipients'], $permissions);
        	$pmdm->set('dateline', TIMENOW);

        	// everything's good!
        	$pmdm->save();
    	}

		if ($formemail == "1")
    	{
        	vbmail($formemailaddress, $posttitle, $formsend);
    	}

    	if ($redirectoption == "1")
    	{
        	$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]";
        	eval(print_standard_redirect('redirect_postthanks'));
        	exit();
    	}
    	if ($redirectoption == "2")
    	{
        	$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t=$newpost[threadid]";
        	eval(print_standard_redirect('redirect_postthanks'));
        	exit();
    	}
    	if ($redirectoption == "3")
    	{
        	$vbulletin->url = 'forumdisplay.php?' . $vbulletin->session->vars['sessionurl'] . "f=$foruminfo[forumid]";
        	eval(print_standard_redirect('redirect_postthanks'));
        	exit();
    	}
    	if ($redirectoption == "4")
    	{
        	$vbulletin->url = 'editpost.php?do=editpost&' . $vbulletin->session->vars['sessionurl'] . "p=$newpost[postid]";
        	eval(print_standard_redirect('redirect_postthanks'));
        	exit();
    	}
    	eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
    	exit();
	}
	else
	{
  		require_once('./includes/class_bbcode.php');
        $parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
        $preview = $parser->do_parse($formsend);

		$_REQUEST['action'] = 'gallery';
	}
}

if ($_REQUEST['action'] == 'gallery')
{
	// set message box width to usercp size
	$stylevar['messagewidth'] = $stylevar['messagewidth_usercp'];
	$editorid = construct_edit_toolbar($vbtextanswer);

	eval('print_output("' . fetch_template("$maintemplate") . '");');
}
}

form template:
Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle] - $formtitle</title>
</head>
<body>
$header
$navbar

<!-- main -->
<if condition="$preview">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">
		Preview
	</td>
</tr>
<tr>
	<td class="alt1">
$preview
</td>
</tr>
</table>
</if>

<br />
<form name="vbform" action="newthread.php" method="post"<if condition="!is_browser('webtv')"> onsubmit="return vB_Editor['$editorid'].prepare_submit(0, $vboptions[postminchars])"</if>>
<input type="hidden" value="$formname" name="do" />
<input type="hidden" value="submit" name="action" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat" colspan="2">
		$vboptions[bbtitle] - $formtitle
	</td>
</tr>
<tr>
	<td class="panelsurround" align="center" colspan="2">

	<table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
	<tr>
		<td align="$stylevar[left]">
			<fieldset class="fieldset" style="margin:0px">
				<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
				<tr>
					<td>
						$formpurpose

					</td>
				</tr>
		</table>
	</fieldset>
</td>
</tr>
</table>
</td>
</tr>

<tr>
<td class="alt1" align="right">
<b>$normalquestion1</b>
</td>
<td class="alt1">
<input type="text" size="30" value="$normalanswer1" name="normalanswer1" /> (first name & last initial)
</td>
</tr>

<tr>
<td class="alt1" valign="middle" align="right">
<b>$dropdownquestion1</b>
</td>
<td class="alt1" valign="middle">
<select name="dropdownanswer1">
<option value="$dropdownchoice1a" <if condition="$dropdownchoice1a == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1a</option>
<option value="$dropdownchoice1b" <if condition="$dropdownchoice1b == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1b</option>
<option value="$dropdownchoice1c" <if condition="$dropdownchoice1c == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1c</option>
<option value="$dropdownchoice1d" <if condition="$dropdownchoice1d == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1d</option>
<option value="$dropdownchoice1e" <if condition="$dropdownchoice1e == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1e</option>
<option value="$dropdownchoice1f" <if condition="$dropdownchoice1f == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1f</option>
<option value="$dropdownchoice1g" <if condition="$dropdownchoice1g == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1g</option>
<option value="$dropdownchoice1h" <if condition="$dropdownchoice1h == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1h</option>
</select></td>
</tr>

<tr>
<td class="alt1" align="right">
<b>$normalquestion2</b>
</td>
<td class="alt1">
<input type="text" size="30" value="$bbuserinfo[email]" name="normalanswer2" /> (for confirmation of this request only)
</td>
</tr>

<tr>
<td valign="top" colspan="2">
<p align="center">
<input type="submit" value="Submit" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="reset" value="Reset" name="reset" style="font-family: Verdana; font-size: 10pt" class="button" />
</p></td></tr>
</table>

</form>

$footer
</body>
</html>
formanswers:
Code:
 $normalquestion1  $normalanswer1 

 $dropdownquestion1  $dropdownanswer1 

 $normalquestion2  $normalanswer2
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 11:04 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.07657 seconds
  • Memory Usage 2,757KB
  • Queries Executed 30 (?)
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
  • (4)bbcode_code
  • (3)bbcode_html
  • (1)bbcode_php
  • (4)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
  • (16)post_thanks_box
  • (16)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (16)post_thanks_postbit_info
  • (15)postbit
  • (16)postbit_onlinestatus
  • (16)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