PDA

View Full Version : Forms Hack


Pages : 1 2 3 [4] 5

bonjurkes
04-08-2006, 10:59 PM
i think its pretty hard to edit that form.

for example i want to remove that longanswer section, i remove the proper parts. The text next to long answer part is disappears but there is a still long answer section here..

I couldnt made the changes that i want to do. I want to use it for application form of moderator.

Is anyone have an example form like that??

Abe1
04-08-2006, 11:49 PM
Hmm, when I click preview it does show me at the top, but all the stuff I entered in the form is gone. I would have to retype it all? What did I do wrong?
You have to make sure the varibles where not changed or edited.

Abe1
04-08-2006, 11:51 PM
Any idea what's wrong with mine?
Yes. You have make // to block out code. Not just one /.

Abe1
04-08-2006, 11:54 PM
Abe1,

Would you mind giving me an example of the impact for upgrading. I don't want to cause any downtime for my primary form when I upgrade.

I'm thinking it might be best to install this as a "new" hook and not overwrite and so a custom "answer" template can be created in parallel without causing disruption?

Also is it only the answer template that needs "lots of changes" or also the mainhook for the form.
The main template was the edited thing. I had to add mostly 'value=' or something simular so it would pull info when you use the preview.

The answer template I believe was not edited.

The hook was edited a little.

Abe1
04-08-2006, 11:55 PM
i think its pretty hard to edit that form.

for example i want to remove that longanswer section, i remove the proper parts. The text next to long answer part is disappears but there is a still long answer section here..


I couldnt made the changes that i want to do. I want to use it for application form of moderator.

Is anyone have an example form like that??
You have to remove the code from the template also.

RDX1
04-09-2006, 12:39 AM
Yes. You have make // to block out code. Not just one /.

Thanks :)

OrangeFlea
04-09-2006, 06:31 AM
Can this thing be used for reviews? I want users to be able to submit reviews (books, movies, etc.) using a modified template of your hack, which essentially means that the form will have been completed at the time of its posting. In other words, when a user clicks on a thread titled "Flea's Review of Lord of the Rings," I want them to see an already completed form that consists of my personal ratings of the movie's elements (e.g., 5-stars for the plot; 4 stars for the score, etc.).

Also, is there a demo of this hack available?

Abe1
04-09-2006, 12:28 PM
Can this thing be used for reviews? I want users to be able to submit reviews (books, movies, etc.) using a modified template of your hack, which essentially means that the form will have been completed at the time of its posting. In other words, when a user clicks on a thread titled "Flea's Review of Lord of the Rings," I want them to see an already completed form that consists of my personal ratings of the movie's elements (e.g., 5-stars for the plot; 4 stars for the score, etc.).

Also, is there a demo of this hack available?
Sorry, I have no demo but you can use this hack to do wat you want.

yayvb
04-09-2006, 07:36 PM
Hi, I used your hack but was having problems with something. I would ask certain questions like average harvest time, have several radio boxes, etc. But if the person hit EDIT then they could edit the text that was output, but they could edit it as if it was a regular message as opposed to editing the various answers to the questions.

In other words when you click EDIT instead of seeing the same sort of form that you filled out originally preopulated with your answers which you can edit and save, it just shows like you're editing a message.

Is there any way that we can use a different template to edit, one that we show the correct variables, etc.? Would we have to insert an if statement into the edit the editpost.php file, or maybe there is a hook in place.

If you are curious what I am talking about, try editing your hack thread here. You get a message box, and the same checkboxes, etc. that you saw originally. How can we do this? Could you provide code samples for a basic example? I think this would make your script go from being a 8 to being a 12 (on a 1 - 10 scale)!!! :)

Abe1
04-09-2006, 08:04 PM
Hi, I used your hack but was having problems with something. I would ask certain questions like average harvest time, have several radio boxes, etc. But if the person hit EDIT then they could edit the text that was output, but they could edit it as if it was a regular message as opposed to editing the various answers to the questions.

In other words when you click EDIT instead of seeing the same sort of form that you filled out originally preopulated with your answers which you can edit and save, it just shows like you're editing a message.

Is there any way that we can use a different template to edit, one that we show the correct variables, etc.? Would we have to insert an if statement into the edit the editpost.php file, or maybe there is a hook in place.

If you are curious what I am talking about, try editing your hack thread here. You get a message box, and the same checkboxes, etc. that you saw originally. How can we do this? Could you provide code samples for a basic example? I think this would make your script go from being a 8 to being a 12 (on a 1 - 10 scale)!!! :)
This would be just about in possable since it's one varible once it's posted.

Heaven
04-09-2006, 09:24 PM
If I change the following line:
$newpost['username'] =& $vbulletin->userinfo['username'];

to
$newpost['username'] = 'Anonymous';

Will the author of the posted thread always be Anonymous? That's what I'm looking to do. Sorry for the dumb question, I'm not a coder.

Abe1
04-09-2006, 10:36 PM
If I change the following line:
$newpost['username'] =& $vbulletin->userinfo['username'];

to
$newpost['username'] = 'Anonymous';

Will the author of the posted thread always be Anonymous? That's what I'm looking to do. Sorry for the dumb question, I'm not a coder.
Nope. Unless that is a real user I think.

MrPatience
04-10-2006, 09:16 PM
Thanks Abe1 for this hack, it is great! Just installed few days ago and it is working perfect.

I have only a question. Sorry if this has been answered before, I searched through the thread and didnt find an answer... I'm running a non-English forum, and I tried to translate the buttons to Send, Reset and Preview form. But when I try things like this:

<input type="submit" value="Enviar" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="submit" value="Previsualizar" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="reset" value="Reiniciar" name="reset" style="font-family: Verdana; font-size: 10pt" class="button" />


then the Reset button does not seem to work, and clicking on Enviar(Submit) does a preview (and the thread is not posted). What am I doing wrong?

Thanks in advance

Abe1
04-11-2006, 12:06 AM
Thanks Abe1 for this hack, it is great! Just installed few days ago and it is working perfect.

I have only a question. Sorry if this has been answered before, I searched through the thread and didnt find an answer... I'm running a non-English forum, and I tried to translate the buttons to Send, Reset and Preview form. But when I try things like this:

<input type="submit" value="Enviar" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="submit" value="Previsualizar" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="reset" value="Reiniciar" name="reset" style="font-family: Verdana; font-size: 10pt" class="button" />


then the Reset button does not seem to work, and clicking on Enviar(Submit) does a preview (and the thread is not posted). What am I doing wrong?

Thanks in advance
I;m not really sure. I believe I have these values hard coded into the hook for submission. I'm not sure why the rest whould not work though.

mcgrco
04-11-2006, 01:01 PM
Hi, I'm currently working for the Medcorps NGO on a project that's allows cambodian doctors to communicate with a network of international doctors. http://www.medicorps.com/updates/cambodia.html
i have only got programming experience in MS Access VBa and implemented a solution using access with outlook integration. Although this works on small scale the project really should be online so it can be rolled out across Cambodia and many other poor countries. The key to its success is the simplicity of the input forms for the doctors. i.e pull down list and simple text boxs should be used to create the first post. the doctors have little or no computer expereince so this is really vital to sucess.

I am in the process of installing the vbulletin softwear which the company kindly donated to Medicorps. Is there anyone out there that could provide guidance to a vbulletin newbi on how i can get my access forms on the web. My concern is that the form is very long (its tabbed in access) and i have no web design experience. Any help is greatfully appreciated.
Thanks in advance

ca99uk
04-11-2006, 04:20 PM
Hello Abe,

Just want to say thank you for all your hardwork with this hack. Subscription now works great and it does exactly what I needed. Fantastic hack, great dev...

Thanks!!!!

Mindwarp
04-11-2006, 06:12 PM
ok so I know I have to be missing an easy step. But I got this stupid flu and I just can't think straight today.

I created another form and named it ModApp but when I goto

http://www.mysite.com/board/newthread.php?do=ModApp

I get
Invalid Forum specified. If you followed a valid link, please notify the administrator

Abe1
04-11-2006, 10:55 PM
ok so I know I have to be missing an easy step. But I got this stupid flu and I just can't think straight today.

I created another form and named it ModApp but when I goto

http://www.mysite.com/board/newthread.php?do=ModApp

I get
It may be conflicting with another hack.

akanevsky
04-11-2006, 11:01 PM
Why does this hack integrate such a large block of code into a single showthread hook? It'd be much more practical if you had this in a separate file. It would also make this hack more compatible with others... :(

TheFocusElf
04-11-2006, 11:08 PM
I want to thank you Abe, in this case it is not just enough to "click install," my friend had me install it on his MMORPG clan's website with some minor edits of my own (just to modifiable code that you indicated in the file), and he writes me daily telling me how nice it has made his "clan's" recruiting go.

So I am passing it on.

-Scott

Abe1
04-12-2006, 02:05 AM
Why does this hack integrate such a large block of code into a single showthread hook? It'd be much more practical if you had this in a separate file. It would also make this hack more compatible with others... :(
Sorry, when making a hack for vb3.5, only if I really need another file do I add one.

Abe1
04-12-2006, 02:11 AM
I want to thank you Abe, in this case it is not just enough to "click install," my friend had me install it on his MMORPG clan's website with some minor edits of my own (just to modifiable code that you indicated in the file), and he writes me daily telling me how nice it has made his "clan's" recruiting go.

So I am passing it on.

-Scott
Glad to hear :)

akanevsky
04-12-2006, 11:00 AM
Sorry, when making a hack for vb3.5, only if I really need another file do I add one.

Even though you don't need to add another file to make this work, I think some coders here - including me - would appreciate it if other people would TRY to avoid making hacks that can conflict with other hacks. In this case, your hack conflicts with my adv.editing options... :(

Abe1
04-12-2006, 12:59 PM
Even though you don't need to add another file to make this work, I think some coders here - including me - would appreciate it if other people would TRY to avoid making hacks that can conflict with other hacks. In this case, your hack conflicts with my adv.editing options... :(
Is there anything I can do to make it compatable?

mcgrco
04-13-2006, 07:03 AM
Firstly, sterling work on this hack. I don't fully appreciate the work you had to put in to it as i don't know how to code but I can appreciate, along with everyone else, the usfulness of such a tool.

Ok, I think I worked out what I need to do with this to get it to work. I assume that I need to edit the xml file to my needs. In a the deep end I guess. Just a couple of quick questions if I might.
I dont know php or html coding but I have some experience with VBA.

Can the form user select which forum the message gets posted to?

Do I need to declare the the variable for each field seperatly. I.e I cant reuse a variable. My form will have over 50 input types so its just a hell of a lot of code.

Given the number of inputs is it possible to split the page in to several pages instead of a continoues form. Not a major if you cant, just wondering.

Many thanks in advance

blacklancer
04-13-2006, 03:42 PM
installed! thanks for this. its awesome.

i have a question on the redirection though....i want it to go straight to payments.php when done with the form(i modified it to act as a membership form) so that they can pay. how would i go about doing that??

yayvb
04-15-2006, 09:29 AM
This would be just about in possable since it's one varible once it's posted.
You know more than me since I'm not a coder plus that makes sense. But it makes me wonder then, how does vbulletin.org do it successfully for their hacks sections??

Abe1
04-16-2006, 01:45 AM
installed! thanks for this. its awesome.

i have a question on the redirection though....i want it to go straight to payments.php when done with the form(i modified it to act as a membership form) so that they can pay. how would i go about doing that??
You can do it. You would ahve to find in the plug-in where the url directs. You should edit to where you want.

Abe1
04-16-2006, 01:46 AM
You know more than me since I'm not a coder plus that makes sense. But it makes me wonder then, how does vbulletin.org do it successfully for their hacks sections??
Give me an example please.

Lucas
04-16-2006, 05:07 AM
How can I make all questions apper on form? http://www.l2prodigy.com/forum/newthread.php?do=form
wanna make it like this: http://www.l2-paradise.com/forums/newthread.php?do=form

Abe1
04-16-2006, 05:09 AM
How can I make all questions apper on form? http://www.l2prodigy.com/forum/newthread.php?do=form
wanna make it like this: http://www.l2-paradise.com/forums/newthread.php?do=form
You have to remove the code from the template.

welo
04-16-2006, 05:20 AM
Dunno if you're still taking suggestions but I thought of something that would be a nice little inclusion for this. It would be extremely helpful if we were able to determine which form fields were posted and which were emailed.

This way, for instance, people could submit a form that contains their wishlist and address while only the wishlist gets posted to the forum. The address - which must remain private - would then be sent to the admin. Naturally you'd want options where the content of a field could be either posted, emailed, or both.

Apologies if this has already been mentioned or the ability already exists.

Lucas
04-16-2006, 12:59 PM
You have to remove the code from the template.
What code from which template?

Abe1
04-17-2006, 12:13 PM
What code from which template?
called 'form'

Abe1
04-17-2006, 12:14 PM
Dunno if you're still taking suggestions but I thought of something that would be a nice little inclusion for this. It would be extremely helpful if we were able to determine which form fields were posted and which were emailed.

This way, for instance, people could submit a form that contains their wishlist and address while only the wishlist gets posted to the forum. The address - which must remain private - would then be sent to the admin. Naturally you'd want options where the content of a field could be either posted, emailed, or both.

Apologies if this has already been mentioned or the ability already exists.
It's possable if you make a new answer template and make a little coding changes. I can't explain right now.

Bounce
04-18-2006, 03:24 PM
Hi Abe

Nice work :)
however lol

I'm trying to remove a few of the options ..

I edit out the $ of what i want to edit out

////////////////////////////////////////////////////////////////////////////////////////////////////
//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,
'longanswer1' => TYPE_STR
));

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

It removes the text but not the input fields :)

I only want 3 options for the form, how do i remove the input fields and the buttons?

Screenshot

http://www.mcdanieldigital.com/comunidad/images/form.jpg

I created the new plugin as per the instructions in the original plugin :confused:

Do I also remove the actual radio Box itself ?

////////////////////////////////////////////////////////////////////////////////////////////////////
//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";

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

Abe1
04-18-2006, 03:25 PM
Hi Abe

Nice work :)
however lol

I'm trying to remove a few of the options ..

I edit out the $ of what i want to edit out

////////////////////////////////////////////////////////////////////////////////////////////////////
//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,
'longanswer1' => TYPE_STR
));

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

It removes the text but not the input fields :)

I anly want 3 options for the form, how do i remove the input fields and the buttons?

Screenshot

http://www.mcdanieldigital.com/comunidad/images/form.jpg

I created the new plugin as per the instructions in the original plugin :confused:
You have to remove the imput fields from the template.

Bounce
04-18-2006, 03:28 PM
You have to remove the imput fields from the template.


just just thought of that and edited my post :)

I shall go try :)

Bounce
04-18-2006, 03:35 PM
Ahhh I see now ... you need to edit out the stuff below the lines that say do not touch unless you know what you are doing lol

Correct? Below an example

if ($answerall == "1")
{
if ($normalanswer1 == '' OR $radioanswer1 == '' OR $radioanswer2 == '' OR $radioanswer3 == '' OR $answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $longanswer1 == '')
{

Abe1
04-18-2006, 03:37 PM
Ahhh I see now ... you need to edit out the stuff below the lines that say do not touch unless you know what you are doing lol

Correct? Below an example

if ($answerall == "1")
{
if ($normalanswer1 == '' OR $radioanswer1 == '' OR $radioanswer2 == '' OR $radioanswer3 == '' OR $answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $longanswer1 == '')
{
Edit that if you change a field.

Bounce
04-18-2006, 03:39 PM
Edit that if you change a field.


EEK !!!! :confused: I'll give it a go , thanks

* Bounce backs up the original lol

SupremeWeapon
04-18-2006, 05:45 PM
I get

Fatal error: Existing data passed is not an array
Called set_existing in /var/www/gamelibraryonline.com/htdocs/dtr/boards/newthread.php(68) : eval()'d code on line 381
Called eval in /var/www/gamelibraryonline.com/htdocs/dtr/boards/newthread.php on line 68
in /includes/class_dm.php on line 235

unedited form. i get that error when trying to submit.

Abe1
04-18-2006, 06:13 PM
I get

Fatal error: Existing data passed is not an array
Called set_existing in /var/www/gamelibraryonline.com/htdocs/dtr/boards/newthread.php(68) : eval()'d code on line 381
Called eval in /var/www/gamelibraryonline.com/htdocs/dtr/boards/newthread.php on line 68
in /includes/class_dm.php on line 235

unedited form. i get that error when trying to submit.
You are trying to start a poll?

SupremeWeapon
04-18-2006, 06:30 PM
actually Yea I am. It's for a team Application.

should I turn that off or something?

Abe1
04-18-2006, 06:31 PM
actually Yea I am. It's for a team Application.

should I turn that off or something?
I'm just trying to see why you would get the error. Make sure all info is correct.

SupremeWeapon
04-18-2006, 06:36 PM
Cleaned th epost up.


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

// 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") . '");');
}
}

mastersite
04-20-2006, 03:22 PM
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?

TomasDR
04-21-2006, 09:11 AM
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!

csidlernet
04-21-2006, 10:06 AM
really cool thanks a lot

Abe1
04-21-2006, 01:33 PM
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.

SupremeWeapon
04-22-2006, 03:44 PM
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

goldenllama
04-22-2006, 05:44 PM
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?

jodycwilliams
04-22-2006, 08:41 PM
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

// 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', $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") . '");');
}
}


Here is the submission template


$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


<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/newthread.php?do=Recruit

If I could just fix this one, small issue, I'd be in love with this hack. Great work bud.

Crazy Serb
04-22-2006, 08:46 PM
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?do=form&review=myhost
The idea is to have that last bit be part of the title itself. Code changed for this:

$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"?

jodycwilliams
04-22-2006, 08:55 PM
hehe, forgot to put a </table> at the end of the answer template.

Got that sucker straightened out.


Amazingly good hack, bud.

Crazy Serb
04-22-2006, 08:57 PM
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!

jodycwilliams
04-22-2006, 09:08 PM
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/newthread.php?do=Recruit and turn it into a page inside of vBadvanced? Anyone know by chance?

Crazy Serb
04-22-2006, 09:48 PM
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!

jodycwilliams
04-22-2006, 09:55 PM
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!

Crazy Serb
04-22-2006, 10:13 PM
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:
// 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:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions - $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:
[b] $normalquestion1 $normalanswer1

$dropdownquestion1 $dropdownanswer1

$normalquestion2 $normalanswer2

jodycwilliams
04-22-2006, 10:19 PM
You're missing a comma after your 3 variable declaration

Crazy Serb
04-22-2006, 10:31 PM
You're missing a comma after your 3 variable declaration


if you're referring to this:

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

that's not it... because the last variable in that array is not supposed to have a coma after TYPE_STR (at least that's how the plugin comes by default).

jodycwilliams
04-22-2006, 10:33 PM
Mine does and it works *shrug*

Crazy Serb
04-22-2006, 11:05 PM
Mine does and it works *shrug*

well, i tried it with or without the comma, and that's not it...

EDIT: I got it, I think...

I changed the $formforumid to "3", which is a non-existant forum on my board (from "0" which was probably giving me an error), and it works just fine now.

However, I am still not getting this form submitted to the email I specified in the template.

Abe1
04-23-2006, 01:15 AM
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?
Find: eval('print_output("' . fetch_template("$maintemplate") . '");'); and you can put defuat values before it.

Abe1
04-23-2006, 01:17 AM
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

// 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', $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") . '");');
}
}


Here is the submission template


$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


<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/newthread.php?do=Recruit

If I could just fix this one, small issue, I'd be in love with this hack. Great work bud.
You can't use HTML in the answer template. You can use BBcode though.

jodycwilliams
04-23-2006, 03:31 AM
*shrug* I redid it with CSS and all and it is working great. Just gotta make sure HTML is enabled in the forum.

Suzie
04-23-2006, 05:48 PM
Is is possible to add the thread rating to the form? I am using this for a product review section and I would like for the user to be able to rate the product with the stars.

rnmcd
04-24-2006, 02:20 PM
I apologize for asking this question because I'm sure it's been answered somewhere in the 50+ pages of post but I only read about 13 pages...



Is it possible to add/remove fields?
For example, can I add 3 more form fields?

Does "This is customizable via the hook" mean that I can add/remove fields?

By the way, I am getting this error:

Parse error: syntax error, unexpected T_LNUMBER in /home/xxxxxxx/public_html/board/newthread.php(68) : eval()'d code on line 127

Any suggestions?



Thank you.

azntfl
04-26-2006, 01:31 AM
Hello

First post btw. This is my first hack and I it is great. I just got one question for now. It is possible to make the text box for the longanswer a little smaller, its quite large.

Thanks in advance.

Abe1
04-26-2006, 02:11 AM
Yes. You can do it in the template.

steven s
04-26-2006, 02:25 AM
I'm not sure if there is a warning when upgrading but. . .
I have a custom additional form that was wiped out when I upgraded.
Fortunately I backed up my database. After restoring the database I saved a local copy. Upgraded and copied my form back. All is good.

rnmcd
04-26-2006, 01:12 PM
I apologize for asking this question because I'm sure it's been answered somewhere in the 50+ pages of post but I only read about 13 pages...



Is it possible to add/remove fields?
For example, can I add 3 more form fields?

Does "This is customizable via the hook" mean that I can add/remove fields?

By the way, I am getting this error:

Parse error: syntax error, unexpected T_LNUMBER in /home/xxxxxxx/public_html/board/newthread.php(68) : eval()'d code on line 127





Any suggestions?



Thank you.

Crazy Serb
04-26-2006, 10:22 PM
is anyone else having a problem with emails being sent/submitted through the form hack (if enabled)?

for me everything works just fine except for the email sending part... and that's the most important feature I need!

COBRAws
04-27-2006, 01:38 AM
Abe1, I've been using this hack for quite a long time but never had the time to thank you =)

TomasDR
04-27-2006, 01:40 AM
Hello

First post btw. This is my first hack and I it is great. I just got one question for now. It is possible to make the text box for the longanswer a little smaller, its quite large.

Thanks in advance.

Modify the number in green:
<tr>
<td class="alt1" valign="middle">
<b>$normalquestion1</b>:</td>
<td class="alt1" valign="middle" colspan="3">
<input type="text" size="50" value="$normalanswer1" name="normalanswer1" />
</td>
</tr>

Uniphix
04-27-2006, 08:07 AM
It took me 2 hours to understand this and finally i got to work :D...

One Suggestion...

under poll


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


Where is the Question? Well i found it down towards the bottom $question...

Perhaps you should rename it to $pollquestion to be the question to be somewhat like this...


//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll = "1";
$pollquestion = "Do you think Abe is Awesome?";
$polloption[1] = "Yes";
$polloption[2] = "No";
$polloption[3] = "Maybe";
//Make poll public - 1 = yes, 0 = no
$pollpublic = "1";


oh yeah... and I LOVE IT thanks!

Uniphix
04-27-2006, 07:21 PM
Hello why am I getting this error o0...


Line: 835
Char: 1
Error: 'vB_Editor.vB_Editor_001' is null or not an object
Code: 0
URL: http://www.paragonix.org/forums/newthread.php?do=staffapplication

davew
04-29-2006, 01:54 AM
This looks like a fantastic mod with loads of potential uses, thanks for all you work Abe!

I've probably overlooked something stupid here, but should the new form pop up when I hit the "New Thread" button in the appropriate forum?

It works fine from the command line, but the button link is omitting "do=form"..

Is this something I have to hack manually?

almukmin
04-30-2006, 02:25 AM
WTF? What kind of moron wrote the installation note?

Where the hell is the "HOOK"? i've been looking in templates and i can't find sh1t.

Where the ++++ is it, I've spent one day looking for it. where the ++++ is it?

WHat the hell is a HOOK? explain man!

Abe1
04-30-2006, 02:55 AM
WTF? What kind of moron wrote the installation note?

Where the hell is the "HOOK"? i've been looking in templates and i can't find sh1t.

Where the ++++ is it, I've spent one day looking for it. where the ++++ is it?

WHat the hell is a HOOK? explain man!
AKA plug-in

phill2003
04-30-2006, 06:10 AM
WTF? What kind of moron wrote the installation note?

Where the hell is the "HOOK"? i've been looking in templates and i can't find sh1t.

Where the ++++ is it, I've spent one day looking for it. where the ++++ is it?

WHat the hell is a HOOK? explain man!



Thats one serious attitude problem you have there, I would think most people will jump at the chance to help you after that abuse...........

Spinball
04-30-2006, 09:20 AM
WTF? What kind of moron wrote the installation note?

Where the hell is the "HOOK"? i've been looking in templates and i can't find sh1t.

Where the ++++ is it, I've spent one day looking for it. where the ++++ is it?

WHat the hell is a HOOK? explain man!

LOL! How to win friends and influence people! :)
NOT!
I would ask the moderators to deal with anyone as rude as this.

gael11
04-30-2006, 09:22 AM
hello, here is my code customized:

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "2";

//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 = "12345";

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

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

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

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

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

//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "pe@gmail.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 = "Merci d'avoir soumis le formulaire!"; //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 = "Feedback";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "$normalanswer1";

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

$formpurpose = "Utilisez ce formulaire pour d?crire le d?roulement de chaque transaction que vous avez effectu?.";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Titre de votre feedback";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Acceptez-vous que votre feedback soit vu par tout le monde ?";

// The following choices must NOT have quotation marks
$radiochoice1a = "Oui";
$radiochoice1b = "Non";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Pseudo du membre avec lequel vous avez effectu? la transaction";
$explain1 = "Veuillez entrer le nom ici.";

//QUESTION 2 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question2 = "Date";
$explain2 = "Entrez ici la date de la transaction.";

//QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question3 = "Transaction";
$explain3 = "Lien menant vers la transaction.";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Type de transaction";

// The following choices must NOT have quotation marks
$dropdownchoice1a = "Achat";
$dropdownchoice1b = "Vente";
$dropdownchoice1c = "Echange";
$dropdownchoice1d = "Don";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Utilisez l'?diteur de texte WYSIWYG ci-dessous pour d?crire le d?roulement de la transaction.";
$vbtextexplain = "Merci de rester poli dans vos commentaires, les insultes ne sont pas tol?r?es.";

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


I'd like to create a thread. But when I submit the form, I obtain the preview screen and the thread isn't created. What could be the problem ?
Thanks for all the answers you could bring me ;)

phill2003
04-30-2006, 11:52 AM
I'm sure the OP has done a preview button for this hack its in the thread somewhere.

gael11
04-30-2006, 01:05 PM
I have take the version 3.3 and works fine now :)

almukmin
04-30-2006, 07:07 PM
Ah, I posted something like I'm sorry, but that was in the other hack, the one that changes the New Thread button link.

Abe, do you have IM IDs?

almukmin
04-30-2006, 07:14 PM
If anyone can help me for a price maybe, let me know OK?

Sorry for the rudeness before, I was really pressed.
The readme file is too simplified.

rnmcd
04-30-2006, 11:22 PM
I am getting this error:

Parse error: syntax error, unexpected T_LNUMBER in /home/xxxxxxx/public_html/board/newthread.php(68) : eval()'d code on line 127

What would I need to do to fix this?

Thanks.

TomasDR
05-01-2006, 12:07 AM
If anyone can help me for a price maybe, let me know OK?

Sorry for the rudeness before, I was really pressed.
The readme file is too simplified.

RTFM: http://www.vbulletin.com/docs/html/add_plugin

After reading the..... you will know what a Hook is. But to make it even more simple, just make your new plugin with the same hook location as the default Form Plugin. But remember you need to make new templates to go with it.

Which you can read about here:

http://www.vbulletin.com/docs/html/stylemanager_add_template

Again just follow the default templates. form & formanswers.

Rahuldhanpat
05-03-2006, 09:37 AM
I m getting this error....i don;t know how to remove this.. Parse error: parse error, unexpected T_STRING in /homepages/17/d92330624/htdocs/Nutraforum.com/newthread.php(68) : eval()'d code on line 1039

I m posting the plugins i saved after hooking it in the newthread_start




/*
// 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 = "views";

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,
'radioanswer1' => TYPE_STR,
'radioanswer2' => TYPE_STR,
'radioanswer3' => TYPE_STR,
'radioanswer3other' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'longanswer1' => TYPE_STR
));

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$radioanswer2 = $vbulletin->GPC['radioanswer2'];
$radioanswer3 = $vbulletin->GPC['radioanswer3'];
$radioanswer3other = $vbulletin->GPC['radioanswer3other'];
$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 = "NUTRAFORUM ";
// Name of the answer template
$answertemplate = "YOUR REPLY";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "2";

//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 = "CO-ADMIN";

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

//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 = "HAVE A NICE TIME & 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 = "1";

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

$formtitle = "Your Views?";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "$Your Views";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 allow you to submit a form, and this form will be made into a thread in a particular forum, or be PMed to a moderator or be emailed to a moderator.";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 was your first impression for NutraForum? ";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 Like to stay more in Nutraforum and become more active? ";

// 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 = "Which Section of the forum do u like most?";

// The following choices must NOT have quotation marks
$radiochoice2a = "N F Board";
$radiochoice2b = "18 +";
$radiochoice2c = "Dr.Love";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Do you give importance to nutrition";

// 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 User name in Nutraforum?";
$explain1 = "Please enter your User 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 Post Count?";
$explain2 = "Please enter your post count here.";

//QUESTION 3 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question3 = "How many of threads , you have visited?(Aprox)";
$explain3 = "Please enter the number 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 = "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 write down a paragraph about NutraForum and its features.";
$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 $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") . '");');
}
}

Abe1
05-03-2006, 11:43 AM
Delete the '/*' from the first line.

rareclownfish
05-07-2006, 01:42 AM
Noob here, where do I go to change the wording(edit) of this.

rareclownfish
05-07-2006, 07:05 PM
Hello anyone???

Lucas
05-08-2006, 01:40 AM
What is this?


Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/l2p/public_html/forum/includes/adminfunctions_template.php(3537) : eval()'d code on line 1

Happened after adding bbcode to the answer form....

Abe1
05-08-2006, 01:58 AM
Make sure you have space after all varibles.

Cajun
05-08-2006, 02:37 AM
Like the hack.

I have one problem. I use a number of styles on my site and can not read some to the text on the forum. You can view here:

http://www.dccombat.com/newthread.php?do=xboxstaffapp

Use any one of the ambience styles.

Can someone tell me if this can be fixed?

Thanks

rareclownfish
05-08-2006, 03:06 AM
Anyone know how to edit this to what I need it to be?

Abe1
05-08-2006, 03:30 AM
Like the hack.

I have one problem. I use a number of styles on my site and can not read some to the text on the forum. You can view here:

http://www.dccombat.com/newthread.php?do=xboxstaffapp

Use any one of the ambience styles.

Can someone tell me if this can be fixed?

Thanks
Have fun editing the Template.

Abe1
05-08-2006, 03:31 AM
Anyone know how to edit this to what I need it to be?
Read the instructions. Edit the Plug-in.

rareclownfish
05-08-2006, 03:51 AM
Read the instructions. Edit the Plug-in.

I'm looking to do something like this.
http://www.fragtraders.com/banners/

How hard is it?

Abe1
05-08-2006, 12:03 PM
I'm looking to do something like this.
http://www.fragtraders.com/banners/

How hard is it?
If you know how to use HTML then it shouldn't be that hard.

Lucas
05-09-2006, 01:33 AM
How can I make it so that the posts are automatically approved instead of having to manually approve them?

Abe1
05-09-2006, 01:44 AM
How can I make it so that the posts are automatically approved instead of having to manually approve them?
It takes the users permissions form the forum where it's getting posted. Make sure the permissions are so that new threads and posts are not moderated.

rnmcd
05-09-2006, 01:00 PM
I am getting this error:

Parse error: syntax error, unexpected T_LNUMBER in /home/xxxxxxx/public_html/board/newthread.php(68) : eval()'d code on line 127

What would I need to do to fix this?

Thanks.

Zero767
05-09-2006, 09:34 PM
Where do I edit the settings?

nvm, got it.

scsa20
05-16-2006, 01:01 AM
Hmm... yeah, I'm not sure if anyone else noticed this but when you have your vbulletin settings set to show the template name in the source code it shows it on the new thread as well... here's what I get after a test:


Generic Form
<!-- BEGIN TEMPLATE: formanswers -->
Generic Form
scsa20

What is the meaning to life?
who knows

Choose one of the following choices
yes

Choose another one of the following choices
good

Is it yes or no? If yes, please elaborate
yes


What is your name?
o_O

What is your email?
hehe@he.he

What is your website?
this place, duh

What is your gender?
male

-----------------------------------------------------
Please write down a paragraph about yourself.

w00t? blah ekjdslfjasldfj

------------------------------------------------------
Please write down a paragraph about how you like this forum.

cookoosdfasdf,lsdjflkjsajfldsajfldsajf

------------------------------------------------------
<!-- END TEMPLATE: formanswers -->


you could see it at: http://www.simon-soft.com/forums/showthread.php?t=137


also, I've installed that "Edt New Thread Button" and followed the instructions but it doesn't seem to work, is there something I'm missing?

kartik786
05-16-2006, 10:40 PM
i installed it.. now how do i make a new form ?? wtf is a hook ??

kartik786
05-16-2006, 10:44 PM
I really liked the idea of this hack so i nominated it for HOTM .. but you know what.. I really cant get this working coz i dont know what to edit and how to.. you should include a read me file so that n00b people who download it know how to use it

scsa20
05-17-2006, 12:56 AM
I know how to use it, it's pretty straight forward, but the "Edit New Thread Button" hack that goes with this hack doesn't seem to work, either that or I'm doing something wrong... plus I got that one problem with the template name showing up in the thread >_>

Gooses
05-17-2006, 04:19 AM
OMG! This is exactly what I have been looking for! Thank you soooo much! :banana:

rnmcd
05-17-2006, 03:03 PM
I am getting this error:


Parse error: syntax error, unexpected T_LNUMBER in /home/xxxxxxx/public_html/board/newthread.php(68) : eval()'d code on line 127
What would I need to do to fix this?

Thanks.

Cebby
05-17-2006, 03:12 PM
Thanks for the great hack.
I would like to add a field that can browse to 1 file, and another button "upload" to attach the file to the post.

Anybody can help me.:)
Thanks again.

Is it possible to attach files and make it attached into the forum thread as well if we choose post in forum ?

I have the same question - searched through all 58 pages and didn't see a reply.

This will be a great addition to my forum (will have forms for recipe input and restaurant reviews). For the recipe inout I'd like to have the option of adding attachments (pics) to the post.

Any ideas for those trying to figure this out - will open doors for more types of forms I'd think.

phill2003
05-17-2006, 03:53 PM
I am getting this error:



What would I need to do to fix this?

Thanks.

post the code 15 lines above and below line 127 then we could have a look if its something simple...

amadergaan
05-20-2006, 06:32 PM
I'm looking for some help...

I wanted to reduce the number of fields..so i deleted some of the variables...but the form still shows the the table for those variables..only blank..how do i get rid of those...

like i deleted all the radio fields....

anyone ?

kartik786
05-20-2006, 06:56 PM
does this work on 3.5.3 ?

phill2003
05-20-2006, 07:47 PM
I'm looking for some help...

I wanted to reduce the number of fields..so i deleted some of the variables...but the form still shows the the table for those variables..only blank..how do i get rid of those...

like i deleted all the radio fields....

anyone ?


You have to delete them from the templates as well....

Barteken
05-20-2006, 09:29 PM
How to set the questions in the form?
what is meant with the hook?

Grtz

Ohiosweetheart
05-20-2006, 09:49 PM
Ok I "think" I've done all of the customizing I need to do.

Now, when I try to go to the form, I get this parse error:
Parse error: parse error, unexpected ':' in /home/exquisi/public_html/forums/newthread.php(68) : eval()'d code on line 187

and this page error: Invalid Forum specified. If you followed a valid link, please notify the administrator

I'm not using this to create a new thread but for my members to submit a story and it is emailed to us.
So is the url above still correct?? (/newthread.php?do=form)
help?

EDIT: In the form template are we supposed to edit any of this?:
<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" />

I really do wish that there were more detailed instructions on editing the templates :(

Ohiosweetheart
05-20-2006, 09:58 PM
does this work on 3.5.3 ?

yes it does

Ohiosweetheart
05-20-2006, 10:40 PM
Ok this is what I'm actually trying to do.............

I need a form for users to submit a story to me.
It will have a box for name/username, one for their email addres, and a small box for additional notes.
Then a LARGE box to type their story into, then will submit and it will be emailed to me. No new post, no new thread, no poll... a simple form to email a story to me.

This is what I have in the hook. Please tell me what I'm doing wrong?


// 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 = "form";

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(
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'longanswer1' => TYPE_STR
));

// Part 2
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$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,23,24,25,27,28))) 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 = "0";

//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 = "2";

//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 = "stories@exquisitelyerotic.net";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 story. You will hear from us soon if any editing is needed. Otherwise, look for it to be posted within the next couple of days!

The Writers Corner Editorial Staff"; //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 = "Submit Your Story";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Use this form to submit your story. It will be sent to our editorial staff.";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question1 = "Your Name or EE Username";
$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 = "Email Address";
$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 = "Copyright Information";
$explain3 = "written by (name or ee username)
? date written, all rights reserved";

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


////////////////////////////////////////////////////////////////////////////////////////////////////
//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 type or paste your story here":
$longexplain1 = "story";

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

////// 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") . '");');
}
}

and now I find that I'm getting that parse error on EVERY new thread started. grrrrrrrrrrrrrrrrrr...

aceofspades
05-21-2006, 09:20 AM
Sorry to be a noob, but i have installed it and its working, but i dont understand your instructions about how to edit it. Usually when i install products there is now an option menu in the settings section of the adminCP. However this time there isnt and i dont understand what you mean by edit the hook.

Can you please explain a little further for a VB noob?

James

Ohiosweetheart
05-21-2006, 09:52 PM
*bump*

RMS-Chef
05-24-2006, 12:10 AM
Hi Abe, I was wondering if there was anything that could be done to get your forms hack working with this new "Thread Notification Alert" hack here (https://vborg.vbsupport.ru/showthread.php?threadid=116399). I realize it is not either one of you guy's responsibility to get your respective hacks working with each other but the Notification does not seem to be working with threads submitted via your forms. I have mentioned this in his thread as well. Hopefully one of you will be able to figure this out because both hacks are fantastic. I can't function without yours but I would love to have his as well. Thank you.

Abe1
05-24-2006, 12:13 AM
I'll try to check it out when I have time. I'm working now on a way to generate a form with someone just giving me what questions that want. It will help thoughs user who dont have time or dont know how to make a custom form using this hack.

RMS-Chef
05-24-2006, 02:24 AM
Thanks for the response Abe.
Does this make sense?
https://vborg.vbsupport.ru/showpost.php?p=986510&postcount=18

Abe1
05-24-2006, 11:49 AM
Thanks for the response Abe.
Does this make sense?
https://vborg.vbsupport.ru/showpost.php?p=986510&postcount=18
No, it does not make any sense. I use that function right now. I dont use my own way to add a thread. I use the regular vb function.

RMS-Chef
05-24-2006, 07:58 PM
No, it does not make any sense. I use that function right now. I dont use my own way to add a thread. I use the regular vb function.
Not sure if it matters but none of my forums that I tested this with are using the vB style editor boxes, just several $longanswer boxes and a few shorts. Not sure if that makes a difference or not. I will test things out on a board that uses the vB editor to see if it makes any difference.

Abe1
05-24-2006, 08:01 PM
Not sure if it matters but none of my forums that I tested this with are using the vB style editor boxes, just several $longanswer boxes and a few shorts. Not sure if that makes a difference or not. I will test things out on a board that uses the vB editor to see if it makes any difference.
There is no diff if you use them or not. This fuction that he said to use, gets used already.

Crazy Serb
05-24-2006, 08:13 PM
is "emailing the form results" feature working for everyone else? is that just me having a problem with that feature of the script?!!!

Michael_Tree
05-25-2006, 02:53 PM
how do i edit the main hook?

Sarcoth
05-26-2006, 12:35 PM
I made my own redirect option. It is working just fine and redirects to the proper page. I need it to do a little more though and not quite sure how to do it yet.


if ($redirectoption == "5")
{
$vbulletin->url = '../index.php?' . $vbulletin->session->vars['sessionurl'] . "page=HOME";
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}

I tried to play around with the code by adding another "IF...ELSE" statement and that gave me an error. Abe, can you or someone else assist me.

I'm trying to have this do one of two things. If someone provides the correct answer to $answer1, the user will be added to a usergroup with the ID = 14 and then they'll be redirected to the congrats page. If someone provides an incorrect answer, they will be redirected to a "Sorry, try again" page instead.

Thanks for keeping this hack updated. It is definitely one of my favorites.

-Sarcoth

upnorth
05-26-2006, 06:37 PM
Does this work with version 3.5.4?

Abe1
05-26-2006, 08:19 PM
Does this work with version 3.5.4?
Yes.

grecostimpy
05-27-2006, 08:24 PM
For some reason my users are receiving subscription emails from the form results thread even though it is in a private forum. How can I prevent this?

I noticed this in the plugin:

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

Can I get rid of this? Any thoughts? They really should not be subscribed/notified of these posts.

Thanks

Abe1
05-28-2006, 12:53 AM
For some reason my users are receiving subscription emails from the form results thread even though it is in a private forum. How can I prevent this?

I noticed this in the plugin:

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

Can I get rid of this? Any thoughts? They really should not be subscribed/notified of these posts.

Thanks
Delete this whole thing and just leave this:

$newpost['emailupdate'] = 9999;

serhat_kk
05-29-2006, 01:15 PM
I'd like to create a thread. But when I submit the form, I obtain the preview screen and the thread isn't created. What could be the problem ?

Abe1
05-29-2006, 02:52 PM
I'd like to create a thread. But when I submit the form, I obtain the preview screen and the thread isn't created. What could be the problem ?
You may have edited the word "Submit".

rylord
05-29-2006, 03:52 PM
I am also looking for the option to add an attachment while submitting the form. Hopefully, the creator of this mod will provide us with the answer to this.

I believe, but haven't tested it yet, that instead of having the final input option on the form as:

1. $vbtextquestion = "Please write down a paragraph about how you like this forum.";

and

2. $vbtextexplain = "For example, what makes this forum different from all other forums?";

We might be able to switch that to what the regular forums are using when a forum user submits a regular forum message. I say this because when you click on submit within a forum area, it comes up with the same looking text editor box, but has the "paper clip" attachment option so the user then has the ability to upload an attachment.

If I knew what this vbbox was called, I could try it out. I don't know enough about vbulletin yet to test it out.

My question then is...instead of using:

$vbtextquestion =
$vbtextexplain =

What would it be for the regular message posting area to come up?

Here is the form I modified so far for my website (see the attached jpeg picture):

I have the same question - searched through all 58 pages and didn't see a reply.

This will be a great addition to my forum (will have forms for recipe input and restaurant reviews). For the recipe inout I'd like to have the option of adding attachments (pics) to the post.

Any ideas for those trying to figure this out - will open doors for more types of forms I'd think.

upnorth
05-29-2006, 05:18 PM
I noticed that the subject of the created thread is the name of the form. Is there any easy way to allow the user to enter the subject?

Abe1
05-29-2006, 05:37 PM
I noticed that the subject of the created thread is the name of the form. Is there any easy way to allow the user to enter the subject?
Look in the plug-in. There is an option to set what you want the title to be. You can have a varible also.

Abe1
05-29-2006, 05:40 PM
I am also looking for the option to add an attachment while submitting the form. Hopefully, the creator of this mod will provide us with the answer to this.

I believe, but haven't tested it yet, that instead of having the final input option on the form as:

1. $vbtextquestion = "Please write down a paragraph about how you like this forum.";

and

2. $vbtextexplain = "For example, what makes this forum different from all other forums?";

We might be able to switch that to what the regular forums are using when a forum user submits a regular forum message. I say this because when you click on submit within a forum area, it comes up with the same looking text editor box, but has the "paper clip" attachment option so the user then has the ability to upload an attachment.

If I knew what this vbbox was called, I could try it out. I don't know enough about vbulletin yet to test it out.

My question then is...instead of using:

$vbtextquestion =
$vbtextexplain =

What would it be for the regular message posting area to come up?

Here is the form I modified so far for my website (see the attached jpeg picture):
The reason the attachment button is not there is because there is no forumID that the form will be posted. The attchement system is pritty hard. The form does not have any set forumid. What if you where sending a PM using it? it can't attach files. Right now the only option I have available is that they get transfered to the edit page where they can upload attachments.

rylord
05-30-2006, 07:56 AM
The reason the attachment button is not there is because there is no forumID that the form will be posted. The attchement system is pritty hard. The form does not have any set forumid. What if you where sending a PM using it? it can't attach files. Right now the only option I have available is that they get transfered to the edit page where they can upload attachments.

I have the form doing two things when they hit the submit button, it sends the info via email to a pre-defined email address, and additionally, at the same time it creates a new thread in a pre-assigned forum that only the admin can see and review the data. Since it has the ability to create the new thread in the hidden forum, why can't we predefine the form to use the forumID of this hidden forum to bring up the edit box - thus allowing the ability for it to attach a file?

Also, by the way: http://www.vbulletin.com/forum/showthread.php?p=1134155#post1134155

Zachery Woods of the vbulletin support team stated in a post over at vbulletin.com recently, "Attachments are currently exclusive to posts now, but they are working on making it non exclusive to anything", but there is no set timeframe of when this will be available.

Abe1
05-30-2006, 12:05 PM
I have the form doing two things when they hit the submit button, it sends the info via email to a pre-defined email address, and additionally, at the same time it creates a new thread in a pre-assigned forum that only the admin can see and review the data. Since it has the ability to create the new thread in the hidden forum, why can't we predefine the form to use the forumID of this hidden forum to bring up the edit box - thus allowing the ability for it to attach a file?

Also, by the way: http://www.vbulletin.com/forum/showthread.php?p=1134155#post1134155

Zachery Woods of the vbulletin support team stated in a post over at vbulletin.com recently, "Attachments are currently exclusive to posts now, but they are working on making it non exclusive to anything", but there is no set timeframe of when this will be available.
I will eventually look into attachments for the form. Not right now though. I'm about to release an update that shows how to add check boxes.

DaPro
05-30-2006, 12:59 PM
This tutorial is for anyone who wants to use this nice hack simply for an affiliation form. So enjoy.

Note: Is there anyway these forms are protected against bot flooding? I don't see an option for human input.

BE SURE TO UPLOAD THE PLUGIN BEFORE DOING ALL OF THIS!

Step 1. Create a new plugin: Plugin Manager > Add New Plugin
- Hook Location: newthread_start
- Title: Affiliation Form
- Plugin Code Below (Edit If you wish)
// 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 = "affiliation";

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,
'normalanswer3' => TYPE_STR,
'longanswer1' => TYPE_STR
));

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$normalanswer2 = $vbulletin->GPC['normalanswer2'];
$normalanswer3 = $vbulletin->GPC['normalanswer3'];
$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_affiliation";
// Name of the answer template
$answertemplate = "formanswers_affiliation";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "0";

//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 = "0";

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

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

//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 = "youremail@domain.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 applying for affiliation with OtakuTalk.com. We will get back to you in 2-3 days time."; //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 = "Affiliation Request";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Thank you for considering affiliation with OtakuTalk.com. Please fill out the form below with all fields answered and then submit it. Thank you!";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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";

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

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

$normalquestion2 = "Website Title";

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

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

$normalquestion3 = "Website URL";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Why would you like to affiliate?";
$longexplain1 = "A simple explaination is all that is needed.";

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

////////////////////////////////////////////////////////////////////////////////////////////////
////// 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") . '");');
}
}
- Be sure to edit the following to your information!
//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "youremail@domain.com";

Step 1. Create form_affiliation Template: Style Manager > Add New Template
- Title: form_affiliation
- Template code below:
$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 class="bginput" type="text" size="30" value="$normalanswer1" name="normalanswer1" />
</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$normalquestion2</b>
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<input class="bginput" type="text" size="30" value="$normalanswer2" name="normalanswer2" />
</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$normalquestion3</b>
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<input class="bginput" type="text" size="30" value="$normalanswer3" name="normalanswer3" />
</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$longquestion1</b> - $longexplain1
</td>
</tr>
<tr>
<td class="alt2" colspan="3" align="center">
<textarea class="bginput" rows="10" cols="90" name="longanswer1">$longanswer1</textarea>
</td>
</tr>
<tr>
<td valign="top" colspan="3">
<p align="center">
<input class="bginput" type="submit" value="Submit" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input class="bginput" type="submit" value="Preview" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input class="bginput" type="reset" value="Reset" name="reset" style="font-family: Verdana; font-size: 10pt" class="button" />
</p></td></tr>
</table>

</form>

$footer
</body>
</html>

Step 2. Create formanswers_affiliation Template: Style Manager > Add New Template
- Title: forumanswers_affiliation
- Template Code Below:
$formtitle

$normalquestion1
$normalanswer1

$normalquestion2
$normalanswer2

$normalquestion3
$normalanswer3

-----------------------------------------------------
$longquestion1

$longanswer1
------------------------------------------------------

Step 3. Accessing your new forum for testing!
- Type the following into your browser to access it: http://www.yourforums.com/newthread.php?do=affiliation
- Fill out all the information and click submit.
- Check your e-mail to see if everything is working.

gamelandz
05-30-2006, 07:02 PM
Hello,
I am unable to add to the drop down box list. I am using the base form...just trying to add to the drop down box list.

how do i do this?

or

How do i create a new form?

thanks,
gamelandz

Abe1
05-30-2006, 07:47 PM
Hello,
I am unable to add to the drop down box list. I am using the base form...just trying to add to the drop down box list.

how do i do this?

or

How do i create a new form?

thanks,
gamelandz
I can't realy explain how to do it. You have to look how I have it set up and you have to play around with it. There are a few places the hack would need editing to add or changes somethings about it.

If you know nothing about PHP and want a nice form for your site, you can PM me and I can create one for you telling me what you want. I'm just about finished with a something that generates forms that has better options then the regular hack.

upnorth
05-31-2006, 02:07 PM
Thanks for the tutorial DaPro. For some reason I'm getting a "Invalid forum specified" message? Any ideas?

upnorth
05-31-2006, 03:46 PM
have done a little more trouble shooting and it seems that as soon as I add another plugin and change the $forumname to something different from the original say something like $forumname="different_form"; then none of the forms will load and I get the error "Invalid forum specified". I've set the plugin up as

Product Form Hack
Hook Location newthread_start
Title different_form
Plugin PHP Code same as the original install files accept I changed
$formname="different_form";
$maintemplate="form_different_form";
$answertemplate="formanswers_different_form";

Abe1 any idea what I'm doing incorrect? Everything works if I set it up as you outlined but as soon as I try to add another form with a different main and answer template the wheels seem to fall off the cart :)

Abe1
05-31-2006, 04:05 PM
have done a little more trouble shooting and it seems that as soon as I add another plugin and change the $forumname to something different from the original say something like $forumname="different_form"; then none of the forms will load and I get the error "Invalid forum specified". I've set the plugin up as

Product Form Hack
Hook Location newthread_start
Title different_form
Plugin PHP Code same as the original install files accept I changed
$formname="different_form";
$maintemplate="form_different_form";
$answertemplate="formanswers_different_form";

Abe1 any idea what I'm doing incorrect? Everything works if I set it up as you outlined but as soon as I try to add another form with a different main and answer template the wheels seem to fall off the cart :)
you go to do=different_form?

upnorth
05-31-2006, 04:10 PM
yep. Before I added the second one it was do=form and that worked. Once I added the second one, neither do=form or do=different_form would work. As soon as I deactivate the second plugin for the different_form then the original do=form will work again????

clear as mud?

Abe1
05-31-2006, 04:26 PM
yep. Before I added the second one it was do=form and that worked. Once I added the second one, neither do=form or do=different_form would work. As soon as I deactivate the second plugin for the different_form then the original do=form will work again????

clear as mud?
You should be able to run 2 at the same time. I dont know why that would be happening.

upnorth
05-31-2006, 05:25 PM
hmm I'll do some more playing around and see what I can figure out. If that doesn't work I guess I'll start from scratch and document the steps. That way maybe I can provide you more info to go on?

Abe1
05-31-2006, 06:29 PM
hmm I'll do some more playing around and see what I can figure out. If that doesn't work I guess I'll start from scratch and document the steps. That way maybe I can provide you more info to go on?
Send me and email bigware at gmail dot com with both product XMLs. I'll see if I can compare them and see the problem.

Abe1
05-31-2006, 09:15 PM
Version 3.5: (05/31/2006)

[ADDED] Check boxes.


I will now create forms for who-ever wants me to. I have created something that will generate a form. You would give me the settings and questions you want and I will give you the file you need to upload so you will have a form for your site. This thing I created has some better features then the hack I distribute. Once you get the form, if you want to make any changes, you would be able to do it in the template. All the questions and descriptions are added directly into the template and are not located in the plug-in.


Here are some of the features that are included: (ones with stars are not in the regular version)

As many forms as you would like. Each form you want to make will not over write another one.
* Ban Certain Usergroups (can?t be used with allow)
Allow Certain Usergroups (can?t be used with ban)
Post form as a new thread
* Option to place the form in different forumIDs based on the URL. You would include ?&f=x? in the URL of the form.
* If using the URL to get forumID, will check to make sure you have it in the URL. Will give error if you don?t.
Option to add a poll to the new thread.
Add any options you want to the poll.
Option to make the poll public.
Post form as reply to existing thread
Send form as PM.
Send PM to many users
Send form as Email
* Send email to many emails
5 different redirect options after you user clicks ?submit?.
Edit Redirect message
Edit Title/Subject for the submitted form. You can put the user?s username or other info.


Please PM me for more info. Include your email address so I can send you all the info you need.

SecTa
05-31-2006, 09:47 PM
Wow! Thanks for the update!
"Option to place the form in different forumIDs based on the URL" will be really helpful for me!

Small question: if user press "Edit" button, will he get to the template or it will be regular editor window?

Abe1
05-31-2006, 09:49 PM
Wow! Thanks for the update!
"Option to place the form in different forumIDs based on the URL" will be really helpful for me!

Small question: if user press "Edit" button, will he get to the template or it will be regular editor window?
When will he press edit?

jugo
05-31-2006, 11:27 PM
Can we get the form creator tool????

THAT would be useful .....

Abe1
05-31-2006, 11:36 PM
Can we get the form creator tool????

THAT would be useful .....
Sorry, it will not be released.

FLMom
06-01-2006, 03:10 AM
just pm'd you ;) Thanks for your hard work on this :D

mastersite
06-01-2006, 08:54 AM
ive pmd you Abe1 ;)

serhat_kk
06-01-2006, 09:36 PM
Thanks for your help Abe1.
How do i remove WYSIWYG editor ?

MrWee
06-02-2006, 05:40 PM
I love this hack!! Ever since I first saw this hack for 3.0, I've wanted to find a way to implement it.

So on my board, we recently installed it and are using it as an "incident report" form that the mods fill out whenever there is a warning or a ban of a user.

The hardest part is getting them to remember to fill it out, so I wonder if someone could help me figure out what to change so that the "ban conformation" screen (the one that says "usera has been banned for 1 week") redirect to this form, instead of to the ban list.

Also, I would like it to include the user name of the person that was just banned in the request string, so it is auto filled in the correct field.

(I already edited the plugin to do this, so newthread.php?do=user_report&uname=foobar puts “foobar” in the field name of the user being reported.)

I don't know if there would be another hook I could use, or if I would have to edit the php files myself, either is fine.

I know this sounds complicated, but if some one could just point me to where I should look at the code, I can probably figure it out!

Thanks in advance!

mrgrimes
06-05-2006, 12:45 PM
Hi. I want the emailed version of the answer template to include stuff not shown in the newly created thread. How do I do this?

Abe1
06-05-2006, 01:04 PM
Hi. I want the emailed version of the answer template to include stuff not shown in the newly created thread. How do I do this?
Not simple. You have to make 2 answer templates and you have to duplicate some things in the plug-in.

mrgrimes
06-05-2006, 01:18 PM
Thanks for the response...

You have to make 2 answer templates

I guessed this might be the case.

and you have to duplicate some things in the plug-in.

Is this very complicated or is it a specific block of code that needs copying and tweaking?

Abe1
06-05-2006, 01:49 PM
Thanks for the response...



I guessed this might be the case.



Is this very complicated or is it a specific block of code that needs copying and tweaking?
You have to copy the code that gets the answer template. Put the copy right before the email function.

mrgrimes
06-05-2006, 04:03 PM
Wonderful, thank you.

DaPro
06-07-2006, 03:50 PM
Abe1,

My concern for this mod is that it would be rather simple for someone to make a bot that could spam someone's inbox with this script. Is there anyway you can include a function that allows for image verification like in registration and sendmessage.php so that a user is required to verify that? This would make me feel much better about this script, I think this could be a serious security issue.

Abe1
06-07-2006, 04:26 PM
Abe1,

My concern for this mod is that it would be rather simple for someone to make a bot that could spam someone's inbox with this script. Is there anyway you can include a function that allows for image verification like in registration and sendmessage.php so that a user is required to verify that? This would make me feel much better about this script, I think this could be a serious security issue.
I'll see if I can make something like this.

CoolHand_79
06-07-2006, 10:42 PM
I am creating a form and would like to have a drop down boxing listing the users from a specific user group on my site. How would I write this?

Thanks,

Luke

hawkan2580
06-08-2006, 12:02 AM
Great great stuff!!!Exactly what I have been looking for apart from one little thing that is obvious that you can get to work based on answers, problem is I don't know how......

I'm looking at getting the User to enter the name so when the form is posted as a new thread, it has a name the user entered.. used as a rewiew form where each User reviews a different product. A similar question was asked and this was the answer:
Look in the plug-in. There is an option to set what you want the title to be. You can have a varible also.

... well, I am a newb at this and would anyone be able to tell me exactly how you change:

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

if ($_REQUEST['do'] == $formname)
{
into a variable so that when people enter in the product name, that becomes the thread title???

http://www.vintagecigarclub.com/forums/newthread.php?do=form

I would like the field "what cigar are you reviewing" to become the thread title when it is submitted.

Would be exremely appreciative of any help with this!

CoolHand_79
06-08-2006, 06:57 PM
I'm looking at getting the User to enter the name so when the form is posted as a new thread, it has a name the user entered..



Not 100% sure what you mean but try this...

Line 412: $posttitle = $name

make $name to be equal to one of the form answers.

For Example:

$posttitle = "$radioanswer2";

Doing this means that when the new thread is created, radio answer 2 will be the subject line.

Hope that helps.

Luke

hawkan2580
06-09-2006, 01:15 AM
Not 100% sure what you mean but try this...

Line 412: $posttitle = $name

make $name to be equal to one of the form answers.

For Example:

$posttitle = "$radioanswer2";

Doing this means that when the new thread is created, radio answer 2 will be the subject line.

Hope that helps.

Luke

Thank you Luke.. that was exactly what I needed!!!

Works like a charm now!!!:banana:

CoolHand_79
06-10-2006, 06:52 PM
I am creating a form and would like to have a drop down boxing listing the users from a specific user group on my site. How would I write this?

Thanks,

Luke

Marcus Lau
06-13-2006, 07:40 AM
How do i add a drop down menu to the categories they want to post - i tried a couple of time but to no avail.

Please advice.

Thanks in advance,
Marc.

Clicked Install.

scofvb
06-13-2006, 11:50 PM
I've been hired by a company, the president of which uses vBulletin sites frequently and wants me to create a Sales Call form for his test site which I just recently got installed. I'm just a simple website design guy and not an experienced vBulletin user--let alone a programmer--so here are my very dumb questions:

- What does the Install button do?
- When I take your advice on this hack (that word sounds dangerous to this newbie) to get it on the site via the Admin CP, where does it reside? I can't find it to modify the parameters.
- My client/president wants this form to be available via a button and have a drop-down menu or radio button selection allowing the user (sales person) to select the city (thread) in which the submit output will go. From your notes and the happy responses I've read, it looks like this hack is exactly what I need. I just need some remedial help in getting started.
- Can you point me to any vBulletin sites that do this kind of thing so I can have a model to emulate?

Does this qualify as the most ignorant post you've ever read?

Thanks in advance for your help.

Abe1
06-14-2006, 02:01 AM
When you click 'install', it means you are using the hack.

I can generate a form to exactly what you need. PM your email and I can email you all the info I would need.

Marcus Lau
06-15-2006, 06:07 AM
Abe would it be good if you could share his hack form with us when u have done. Well, i Pmed you, could you please reply too.

Thanks.

SupremeWeapon
06-18-2006, 03:28 AM
Tell you what. I decided to wait for fixes to all the issues i reported. just tried you rnew version and it posts to pm like a glove is required to catch a 100m,ile an hour fast ball( means it works perfectly)


***Reclicks install***

great job

ONE THING.


is there a way to allow for this to have attachments?


Like 2 different places have a user upload something to it and then when its pmed it is sent to the uperson with the files as attachments?


that would be a big help

Abe1
06-18-2006, 11:53 AM
Tell you what. I decided to wait for fixes to all the issues i reported. just tried you rnew version and it posts to pm like a glove is required to catch a 100m,ile an hour fast ball( means it works perfectly)


***Reclicks install***

great job

ONE THING.


is there a way to allow for this to have attachments?


Like 2 different places have a user upload something to it and then when its pmed it is sent to the uperson with the files as attachments?


that would be a big help
I will try to get attachments to work again when I come out with a vb3.6 version. Not sure it would work though.

Also, you wont be able to get it to work with PM's since there is no attachment feature with PM's.

mrgrimes
06-20-2006, 05:53 AM
I've got a problem with new threads. The form is being emailed fine, but new threads are not being created.

This isn't the first time I've used this plugin, so it must be something I've done wrong. I've checked the plugin and templates over and over again, and checked them against other instances of the plugin, but I can't see where the problem is.

There's no error message and the user permissions seem to be correct. The forum ID is also correct.

Any ideas?

Abe1
06-20-2006, 11:46 AM
I've got a problem with new threads. The form is being emailed fine, but new threads are not being created.

This isn't the first time I've used this plugin, so it must be something I've done wrong. I've checked the plugin and templates over and over again, and checked them against other instances of the plugin, but I can't see where the problem is.

There's no error message and the user permissions seem to be correct. The forum ID is also correct.

Any ideas?
Does the user have permission to make a new thread?

Canis Firebrand
06-20-2006, 04:09 PM
I used the plugin, and put in the forum id and thread id to have the forum submit to an existing thread.

When I type in all the info and hit submit, I get the following message

"No Thread specified. If you followed a valid link, please notify the administrator"

I turned on the redirection to have it take me to the post, and when the above message shows, in the url it has this at the end showthread.php?p=

With the default setup, after submitting, I get the message "Thanks for submitting the form." and it looks like it makes the post. But, no new post is made.

I am posting with proper permissions, and the forum id and thread id do exist.

I enabled the option to have the form PM'ed to me, and I do get a PM as soon as I hit submit with the proper info.

It just seems to be hanging up on creating the post.

**EDIT**

After reading page 52, it appears I may have my answer. I use Psionic Vision's adv.editing options hack. Has any inroad been made to resolve why these two plugings conflict?

I disabled the adv. edition hack, and it did make a post successfully. However, it created a new thread. It didn't add it to an existing thread like I said to in the options.
It did, at least, put it in the right forum.

*EDIT*

Actually, it appears that it did append it to an existing thread. But, it also created a new thread. Strange.

Boinger
06-20-2006, 05:16 PM
is there a way to make a form so only one user group can view it but everyone can post to it ?

Boinger
06-22-2006, 02:21 AM
i am gettin an error

it is saying that everything went through ok and it posted but it is not making a new thread..

Domenico
06-22-2006, 10:44 AM
Do I need to make own links to the forms or does the newreply button automaticly link to the form url ?

Crazy Serb
06-28-2006, 03:17 AM
You have to copy the code that gets the answer template. Put the copy right before the email function.

you mean right before the "vbmail($formemailaddress, $posttitle, $formsend);" line?

and if I include user's email as one of the answers, when it's emailed it gets emailed/inserted as

email@address.com

which looks really weird in an email... any workaround for that?

CoolHand_79
06-28-2006, 10:03 AM
I am creating a form and would like to have a drop down boxing listing the users from a specific user group on my site. How would I write this?

Thanks,

Luke

Abe1
06-28-2006, 11:51 AM
you mean right before the "vbmail($formemailaddress, $posttitle, $formsend);" line?

and if I include user's email as one of the answers, when it's emailed it gets emailed/inserted as

email@address.com

which looks really weird in an email... any workaround for that?
No work around right now.

When vb3.6 comes out, there will be a work around.

mcgrco
06-29-2006, 07:34 PM
Oh what have I done. I was playing around with the forums and now the form won't work. admin, you do not have permission to access this page. This could be due to one of several reasons:

1. Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
2. If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

I set the redirectoption = 4 but it wont work. Anyone able to help

bayridge
07-03-2006, 01:54 AM
Is there a way to make user enter the post title? For instance, I would like the answer from $normalquestion1 to be the $posttitle. Whatever the user enters in that box should be the title of the post. Can this be done? Thx.

armstrong
07-03-2006, 11:44 AM
Hi! I have the icash hack installed for my forum money, and I'm interested in exploring applicability of these two functions of your forms hack:

># Order form to buy things
># Donation form

How are these things done with the forms hack, in the context of forum money? Is it even applicable?

Polo
07-03-2006, 03:52 PM
Cool Hack!

powermoves
07-03-2006, 04:26 PM
Abe1
Can you help me understand a little better:
Of the steps below I completed step 1
However I dont understand how to perform step 2. How do I edit the main hook and after that how will I make the form.
Any help you can give would appreciated.

Thank you.
1 - Import the xml into products. (admin cp -> Plugin System -> Manage Products -> Add/Import Product)
2 - Edit the main hook - the instructions are all inside the hook itself, in the top half. Follow the instructions carefully!
3 - To get to the form, go to: /newthread.php?do=form (change "form" to the name of your form if you have few)

DoKoK
07-03-2006, 05:17 PM
Need some help...

I'm trying to modify my form but have no luck...

Link to the form: http://www.en-raptured.com/main/newthread.php?do=app

I tried to put the following

//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(
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'answer4' => TYPE_STR,
'answer5' => TYPE_STR,
'answer6' => TYPE_STR,
'answer7' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'checkboxanswer1_1' => TYPE_STR,
'checkboxanswer1_2' => TYPE_STR,
'checkboxanswer1_3' => TYPE_STR,
'checkboxanswer1_4' => TYPE_STR,
'checkboxanswer2_5' => TYPE_STR,
'checkboxanswer2_6' => TYPE_STR,
'checkboxanswer2_7' => TYPE_STR,
'checkboxanswer2_8' => TYPE_STR,
'checkboxanswer2_9' => TYPE_STR,
'longanswer1' => TYPE_STR
));

// Part 2
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$answer4 = $vbulletin->GPC['answer4'];
$answer5 = $vbulletin->GPC['answer5'];
$answer6 = $vbulletin->GPC['answer6'];
$answer7 = $vbulletin->GPC['answer7'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$checkboxanswer1_1 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_2 = $vbulletin->GPC['checkboxanswer1_2'];
$checkboxanswer1_3 = $vbulletin->GPC['checkboxanswer1_3'];
$checkboxanswer1_4 = $vbulletin->GPC['checkboxanswer1_4'];
$checkboxanswer2_5 = $vbulletin->GPC['checkboxanswer2_5'];
$checkboxanswer2_6 = $vbulletin->GPC['checkboxanswer2_6'];
$checkboxanswer2_7 = $vbulletin->GPC['checkboxanswer2_7'];
$checkboxanswer2_8 = $vbulletin->GPC['checkboxanswer2_8'];
$checkboxanswer2_9 = $vbulletin->GPC['checkboxanswer2_9'];
$longanswer1 = $vbulletin->GPC['longanswer1'];

DoKoK
07-05-2006, 02:21 AM
Anyone?

DoKoK
07-06-2006, 04:50 AM
Shameless bump...really need help with it :/

Abe1
07-06-2006, 12:35 PM
You have to edit the template also.

PimvanJ
07-06-2006, 02:27 PM
Do I edit the xml product file directly?
I have no idea where to start, Is there some sort of help for Vbdummies?

UManiac
07-06-2006, 04:37 PM
Can I hav the form PM'ed to a specific user group?

Thanks

UManiac
07-06-2006, 04:55 PM
You have to edit the template also.

sorry; figured it out...

UManiac
07-06-2006, 09:12 PM
While browsing the thread I noticed people requesting for the abilit to include attachments. Is this something that has been implemented?

My primary purpose for the form hack is to send PM's to a specific user group; I would like to include an attachment as well.

Right now I'm running only one other hack in my forum - PM Attachments (https://vborg.vbsupport.ru/showthread.php?t=91220)

Any chance the functionality from one can be used in the other?

Thanks!

DoKoK
07-06-2006, 09:58 PM
You have to edit the template also.

Which template are you reffering to?

UManiac
07-07-2006, 12:58 PM
You have to edit the template "form"

Mysticales
07-11-2006, 03:06 AM
Ohh nice! I wish there was a thing like this for 3.0.9! Could use one so users couple submit news via PM to a mod to get posted about.

Edit: I feel stupid... just found the old version lol.. but yea.. trying to design a button users to click for devs to submit their apps if they post it on the forums. =)

steven s
07-11-2006, 12:14 PM
When vb3.6 comes out, there will be a work around.Any timeframe? This is the one mod that does so much for me. I'll hold off updating to Gold for this one. This mod has been a lifesafer. :banana:

Americankiwi
07-11-2006, 10:42 PM
Hi,

I managed to install it, and can view the altered form I've made in my browser, but have some questions (as I am not a coder)

1. How can I add a button in specific forums, that replaces the "New Thread" button with a "New Review" button?

I would like to make forums that allow one person to (instead of starting a "New Thread") start a "New Game Review" that opens up the form I've made.

2. How can I make the contents of the user's form go at the very top of the page, visually different/ separate from the rest of the thread?

I'd like other people reading the thread to be able to comment on that person's review below.

3. How can I make it so that the field in which they input the Name of the Game they are reviewing becomes the Title of the thread?

and finally 4. I noticed that posted results are not very well aligned. Is there some code reference for newbies someone could point me to, so that I can align the resulting form post - i.e. make it look more professional?

Thanks in advance,

TS

Stajerc
07-13-2006, 09:36 AM
Hi Abe

sry for my bad english.
i use a translated german version of this hack. it works perfekt, but only one thing wont work as i want.
the hack have to post in a existing thread, and the hack do this. but it post a new thred too. i dont know why.

jluerken
07-14-2006, 08:09 AM
Will this great hack be available for 3.6?

wizadora
07-18-2006, 02:03 PM
Hi,

This works great for posting into one forum, but I'm having a problem figuring out how to get it to post to various forums depending on the value selected from the drop-down.

What I am trying to achieve is this :

If dropdownanswer1 = dropdownchoice1a then formforumid="59"
If dropdownanswer1 = dropdownchoice1b then formforumid="26"

I have about 18 different forums where this form will be used, I only have 3 in the templates for now for testing.

Can't seem to figure out whether the problem lies in the hook, or whether there needs to be some template mod.

Anything I try results in either a parse error or a scalar value error.

Any help appreciated.

Thx.


// 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 = "guildpm";

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(
//'radioanswer1' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
//'answer3' => TYPE_STR,
//'answer4' => TYPE_STR,
//'answer5' => TYPE_STR,
//'answer6' => TYPE_STR,
//'answer7' => TYPE_STR,
'longanswer1' => TYPE_STR,
//'longanswer2' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
//'answer8' => TYPE_STR,
));

// Part 2
//$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
//$answer3 = $vbulletin->GPC['answer3'];
//$answer4 = $vbulletin->GPC['answer4'];
//$answer5 = $vbulletin->GPC['answer5'];
//$answer6 = $vbulletin->GPC['answer6'];
//$answer7 = $vbulletin->GPC['answer7'];
$longanswer1 = $vbulletin->GPC['longanswer1'];
//$longanswer2 = $vbulletin->GPC['longanswer2'];
//$answer8 = $vbulletin->GPC['answer8'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "gui_form_guildpm";
// Name of the answer template
$answertemplate = "gui_formanswers_guildpm";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "109";
//$formforumid = $f ;


//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll = "0";
$polloption[1] = "Approve";
$polloption[2] = "Denied";
$polloption[3] = "Decline";
$polloption[4] = "No vote";

//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 = "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 = "Letter has now been posted to the Guild."; //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 = "Send a Letter to a Guild";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "$answer1 | $answer2";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 allow you to send an IC letter to a Guild. The letter will only be seen by that Guild";

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


//$radioquestion1 = "Choose the type of your request:";
//$radiochoice1a = "Request for Class";
//$radiochoice1b = "Request for Subrace";
//$radiochoice1c = "Request for Special Names";
//$radiochoice1d = "Other Requests";

$question1 = "1. Name of Character:";
$explain1 = "Please enter your characters name here.";

$question2 = "Subject";
$explain2 = "Please enter a subject line";

//$question3 = "3. NWN Account:";
//$explain3 = "Please enter your NWN account with which you want to create the requested character.";

//$question4 = "4. Current level of character:";
//$explain4 = "Please enter the current level of your character (in case it already exists).";

//$question5 = "5. Current CLASS of character:";
//$explain5 = "";

//$question6 = "6. Alignment:";
//$explain6 = "";

//$question7 = "7. Spell focus or Weapon focus:";
//$explain7 = "";

$longquestion1 = "Enter Letter here";
$longexplain1 = "Enter your IC letter here";

//$longquestion2 = "9. An OOC summary of the request:";
//$longexplain2 = "";

//$question8 = "10. Mentor's name for any class that may require:";
//$explain8 = "";

$dropdownquestion1 = "Which Guild to send this to";

// The following choices must NOT have quotation marks
$dropdownchoice1a = "Blackwood";
$dropdownchoice1b = "Halfling Alliance";
$dropdownchoice1c = "LightWarrior Merchants";


////////////////////////////////////////////////////////////////////////////////////////////////
////// 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 ($checkboxchoice1_1 AND $checkboxchoice1_2 AND $checkboxchoice1_3) 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") . '");');
}
}

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

<!-- main -->
<br />

<form enctype="multipart/form-data" method="post" action="newthread.php">
<input type="hidden" value="$formname" name="do" />
<input type="hidden" value="submit" name="action" />
<input type="hidden" value="$forumid" name="f" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="60%" 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 width="50" valign="middle" class="alt1"> <b>Username</b></td>
<td class="alt1" valign="middle"> <b>$bbuserinfo[username]</b></td>
</tr>
<tr>
<td class="alt1" valign="middle" colspan="2">&nbsp;</td>
</tr>
</tr>
<tr>
<td class="alt1" valign="middle">
<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>
</select></td>
</tr>
<tr>
<td colspan="2" valign="middle" class="alt2"> &nbsp;</td>
</tr>
<tr>
<td colspan="2" valign="middle" class="alt2"> <b>$question1</b></td>
</tr>
<tr>
<td colspan="2" valign="middle" class="alt1"><span class="alt2">
<input name="answer1" type="text" value="" size="70">
</span></td>
</tr>
<tr>
<td class="alt2" valign="middle" colspan="2">&nbsp;</td>
</tr>

<tr>
<td colspan="2" valign="middle" class="alt2"><b>$question2</b></td>
</tr>
<tr>
<td colspan="2" valign="middle" class="alt1"><span class="alt2">
<input name="answer2" type="text" value="" size="70">
</span></td>
</tr>

<tr>
<td class="alt2" valign="middle" colspan="2">&nbsp;</td>
</tr>

<tr>
<td class="alt2" valign="middle" colspan="2"><b>$longquestion1</b></td>
</tr>

<tr>
<td colspan="2" valign="middle" class="alt1"><textarea rows="10" cols="70" name="longanswer1"></textarea> </td>
</tr>
<tr>
<td class="alt2" valign="middle" colspan="2">&nbsp;</td>
</tr>

<tr>
<td class="alt1" 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>

answer template
Letter placed by: $bbuserinfo[username]
-----------------------------------------------------
To the Leaders of $dropdownanswer1
-----------------------------------------------------
From: $answer1
-----------------------------------------------------
Subject : $answer2
-----------------------------------------------------
$longanswer1

Sarcoth
07-19-2006, 01:50 AM
Usergroup Question

////////////////////////////////////////////////////////////////////////////////////////////////////
//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'.
// 2 = Registered Users // 6 = Administrators // 11 = Lore Enthusiast // 12 = Lore_Room_01
////////////////////////////////////////////////////////////////////////////////////////////////////

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

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

As you can see, I have this set to allow usergroups 6 and 11 to view and to use this form. This only checks to see if they are in a Primary group though. I'd like the form to check to see if the user was in either of these groups as a Primary or Additional. Can anyone tell me how to do that?

Also, once the form is completed, I'd like to add a line at the end of the form to add them to a different "Additional Usergroup". Any help would be appreciated and I'll gladly send you $10 via paypal if you coding makes this work.

Thanks,
Nick

Abe1
07-19-2006, 02:07 AM
Usergroup Question

////////////////////////////////////////////////////////////////////////////////////////////////////
//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'.
// 2 = Registered Users // 6 = Administrators // 11 = Lore Enthusiast // 12 = Lore_Room_01
////////////////////////////////////////////////////////////////////////////////////////////////////

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

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

As you can see, I have this set to allow usergroups 6 and 11 to view and to use this form. This only checks to see if they are in a Primary group though. I'd like the form to check to see if the user was in either of these groups as a Primary or Additional. Can anyone tell me how to do that?

Also, once the form is completed, I'd like to add a line at the end of the form to add them to a different "Additional Usergroup". Any help would be appreciated and I'll gladly send you $10 via paypal if you coding makes this work.

Thanks,
Nick
Let me know if this works. I wrote this for a prive hack and modifide it for you.
$check1 = explode("|", '6|11');
$check3 = explode(",",$vbulletin->userinfo[membergroupids]);

foreach ($check1 AS $check2)
{
if ($check2 == $vbulletin->userinfo[usergroupid])
{
$is++;
}

foreach ($check3 AS $check4)
{
if ($check2 == $check4)
{
$is++;
}
}
}

if (!($is))
{
print_no_permission();
}

Sarcoth
07-19-2006, 03:02 AM
Abe1,

You are good. That definitely did the trick. :) Just PM me with an email to send the Paypal donation.

I did have a 2nd request in that message though, I'm guessing you missed it.

Also, once the form is completed, I'd like to add a line at the end of the form to add them to a different "Additional Usergroup".

At the end of the form, I'd like to have them added to Membergroupids 12 (Additional Usergroup). In other words, I don't want the group to become the Primary for them, just to have them added to a secondary.

I'll put ADD_MEMBERGROUPIDS_HERE; for where I'd like to add it in my code.

if ($redirectoption == "5")
{
if (($quest_answer == 'ANSWER') || ($quest_answer == 'answer'))
{
$vbulletin->url = '../index.php?' . $vbulletin->session->vars['sessionurl'] . "page=Next_Page";
ADD_MEMBERGROUPIDS_HERE;
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}
else
{
$vbulletin->url = 'newthread.php?' . $vbulletin->session->vars['sessionurl'] . "do=Same_Form";
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}
}

That will add them to Membergroupids 12 only if they type in ANSWER or answer in the form.

Thanks again for your help!

Abe1
07-19-2006, 03:16 AM
Abe1,

You are good. That definitely did the trick. :) Just PM me with an email to send the Paypal donation.

I did have a 2nd request in that message though, I'm guessing you missed it.



At the end of the form, I'd like to have them added to Membergroupids 12 (Additional Usergroup). In other words, I don't want the group to become the Primary for them, just to have them added to a secondary.

I'll put ADD_MEMBERGROUPIDS_HERE; for where I'd like to add it in my code.

if ($redirectoption == "5")
{
if (($quest_answer == 'ANSWER') || ($quest_answer == 'answer'))
{
$vbulletin->url = '../index.php?' . $vbulletin->session->vars['sessionurl'] . "page=Next_Page";
ADD_MEMBERGROUPIDS_HERE;
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}
else
{
$vbulletin->url = 'newthread.php?' . $vbulletin->session->vars['sessionurl'] . "do=Same_Form";
eval(print_standard_redirect('redirect_postthanks' ));
exit();
}
}

That will add them to Membergroupids 12 only if they type in ANSWER or answer in the form.

Thanks again for your help!
You can use the paypal donate link for this hack above.

I must have missed the 2nd part. It would take a while ot make the other thing.

wizadora
07-19-2006, 11:46 AM
Any info on the drop-down ? This has been asked in this thread so many times (not just by me) but no answers. As I said in my post above, it works fine for posting to a single pre-defined forumid.

Would I just be best just hard-coding the template with the drop-choices and then passing the forum ID back instead of the choices ? I'm at a loss of the best way to go about this.

thx.

Sarcoth
07-20-2006, 07:05 PM
Abe1,

Just curious, for adding to a Membergroupids, could we just reuse the code you gave me for checking to see if someone is in a Membergroup and then instead of "print_no_permission();" -- you could instead say add that membergroupid to this user?

Something like this (12 being the secondary member group I want to add the user to if they answer correctly):

$check1 = explode("|", '12');
$check3 = explode(",",$vbulletin->userinfo[membergroupids]);

foreach ($check1 AS $check2)
{
if ($check2 == $vbulletin->userinfo[usergroupid])
{
$is++;
}

foreach ($check3 AS $check4)
{
if ($check2 == $check4)
{
$is++;
}
}
}

if (!($is))
{
$check3->set('membergroupids', $check3);
}

Not to sure what to put in that final if statement, but was hoping you would. I've been testing a few things with no luck.

The other thing I tried was something Amy had posted for adding to a secondary group. Sadly it gave a Fatal error: Call to a member function on a non-object in ..../newthread.php(68) : eval()'d code on line 403. I know I missed setting a variable, but just not sure what one and what to set there.

$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = $membergroupids . ", 12";
}
else
{
$membergroupids = 12;
}
$userdata->set('membergroupids', $membergroupids);

Anyhow, I'll take what I can get. Thanks again for your help on the first problem.

Narcootic
07-21-2006, 01:44 PM
Hi, great hack, have it installed and its working except for Unregistered users. I have tested it with other usegroups and it works fine but guests form inputs simply arent processed. The thread is created but the thread does not have any content. I have set all the permissions for guests to allow them to post in the thread where the form should submit the output of the form but it just creates a thread with nothing in them except "Unregistered". Any ideas? I have set the permissions correctly, I am pretty sure. Any chance of some assistance please :)

If you look at the attachment, you will see how it looks like, all screwed up :(

Thank you.

Stajerc
07-22-2006, 07:21 AM
Hi Abe

sry for my bad english.
i use a translated german version of this hack. it works perfekt, but only one thing wont work as i want.
the hack have to post in a existing thread, and the hack do this. but it post a new thred too. i dont know why.

is there no support now??

Spikeh
07-22-2006, 01:49 PM
Just got this hack installed and configured for one form how I wanted it. Nice work Abe1, just what I needed!

Sarcoth
07-23-2006, 05:07 AM
I haven't heard back from Abe yet, so I'll make another offer here. I'll give a $10 donation to someone if they come up with some workable coding to add a user to a membergroup within this form. Please see my request in a previous post. I'll post in another forum for help on this if I don't see an answer here within a few days.

Post here or send me a PM if you have additional questions.

Thank you!

CremeEgg
07-24-2006, 12:37 PM
I have a quick question regarding the answers template.

When using vB code for formatting in the answers template you have to have spaces i.e.

[b] $answer1 [/b ]

Well I am using the WoW Items hack and want to format the answers to the questions as items, so I put in the template

[item] $normalanswer1 [/item ]

But with the spaces included the item links don't work, if I remove the spaces you can't use the template, is there anyway around this?

Abe1
07-26-2006, 02:48 AM
I have a quick question regarding the answers template.

When using vB code for formatting in the answers template you have to have spaces i.e.

[b] $answer1 [/b ]

Well I am using the WoW Items hack and want to format the answers to the questions as items, so I put in the template

[item] $normalanswer1 [/item ]

But with the spaces included the item links don't work, if I remove the spaces you can't use the template, is there anyway around this?
You can remove the space before the varible. See what happens then.

Abe1
07-26-2006, 02:49 AM
is there no support now??
I don't give support to custom edits for this hack. I only support bugs that might come up in the coding of it.

It would be too much for me if I helped everyone make a custom form.

Stajerc
07-26-2006, 08:02 AM
ahh i undertand, thx.

NetRover
07-26-2006, 02:41 PM
Hi there, can the thread title have pre-defined text with variables from the form inserted to make a title that is a combination of both.

eg: I am "$formanswername" living in "$formanswerlocation" looking for "$formanswerrequest" etc.

many thanks for what looks like a great hack.

CremeEgg
07-27-2006, 08:01 AM
You can remove the space before the varible. See what happens then.
You get the following error

The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /*PATH TO SITE*/forum/includes/adminfunctions_template.php(3537) : eval()'d code on line 30

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
You can choose to continue, and if you do you can fill out the form ok, however if you try to preview or submit you get a blank white page and nothing happens.

jzewatsky
07-28-2006, 02:03 AM
Thanks for the great plug in!

Unfortunately, I am getting the following error:

Parse error: parse error, unexpected ')' in /home/content/d/d/r/ddrcn/html/forums/newthread.php(68) : eval()'d code on line 750

I know it's just that I have an extra ")" somewhere, but I cant find where. There are only 414 lines in my newthread.php.

Any suggestions would be great!

Sarcoth
07-28-2006, 12:10 PM
The error says newthread.php, but that isn't where your problem is located. Look through your form, most likely on line 750.

jzewatsky
07-28-2006, 12:43 PM
Thank you Sarcoth, but my form only has 454 lines. I'm not familular with the hooks feature and how it functions, but is it possible that the two are somehow being added to eachother. If this is the case, where would I cut and paste the hook into the newthread.php to find the correct line 750?

Again, I appreciate any help!

Abe1
07-28-2006, 02:11 PM
Thank you Sarcoth, but my form only has 454 lines. I'm not familular with the hooks feature and how it functions, but is it possible that the two are somehow being added to eachother. If this is the case, where would I cut and paste the hook into the newthread.php to find the correct line 750?

Again, I appreciate any help!
Do you have more then one hack that uses that hook location? Disable the others and a differant line number should show.

jzewatsky
07-28-2006, 03:29 PM
Thanks Abe1. This hack is just what my forum needed! Thanks for writing it and for helping me to get it working!

Allan
07-28-2006, 05:24 PM
Hey, this hack work with vB 3.6 ?

Abe1
07-28-2006, 06:14 PM
Hey, this hack work with vB 3.6 ?
Yes, it works with 3.6. There will be a new version of it though which has one template fix. Nothing major.

tommyxv
07-29-2006, 09:02 AM
I am getting this error:
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /home/mysite/public_html/forums/newthread.php(68) : eval()'d code on line 724


I found it to be a conflict with PaulM's reposted post creates a new thread hack. (https://vborg.vbsupport.ru/showthread.php?t=83074) When I disable it, the forms hack works and the error goes away.

Any idea on how to fix?

bugman
07-30-2006, 06:26 PM
SUPERB! EXCELLENT! GREAT WORK!

I am using this for an application for my gaming clan and it's perfect! Highly customisable which is great!

This has many, many uses! Quizzes, tests, applications and so much more.

I will give you the link to my clan soon so you can see in action.

THANK YOU!

MoJo Smirnoff
07-30-2006, 08:22 PM
I haven't heard back from Abe yet, so I'll make another offer here. I'll give a $10 donation to someone if they come up with some workable coding to add a user to a membergroup within this form. Please see my request in a previous post. I'll post in another forum for help on this if I don't see an answer here within a few days.

Post here or send me a PM if you have additional questions.

Thank you!


i too would like to be able to put users in another user group once they hit submit....either as primary or a secondary group. Is this possible?


great hack btw, we are using this for new recruits to the gaming clan...we've needed this for a year now!! Great stuff!

Miss Tiina
07-31-2006, 06:07 PM
Hi I have 2 forms on my site. I thought I had changed the hook name properly to allow both forms to work but something isnt working right. Can someone please explain to me exactly what I change and where I change it to ensure both forms work, Thanks so much :)

Sarcoth
08-01-2006, 07:50 PM
Hi I have 2 forms on my site. I thought I had changed the hook name properly to allow both forms to work but something isnt working right. Can someone please explain to me exactly what I change and where I change it to ensure both forms work, Thanks so much :)

They need different names under "Plugin Manager"; which you must have done since I doubt you can save one with the same name and you need to rename the $formname. Open up one of the forms and go down a few lines, rename the $formname and you'll have two identical forms with different names.

If you changed other data within the form though, like the number and type of questions, you have to add or remove various data from your form plugin, the form template and the formanswers template. If you change one of these, there is a good chance you'll have to update all three.

Personally, I made a copy of each and then editted them out till I got it the way I liked.

mschvili
08-02-2006, 01:53 PM
Hi Abe.

I know. Here's another one asking for the attachment. I sure would help a lot if it would be able to attach files.

I will use the form in a support function and if the user won't be able to send pictures of their problems.. then it would be a whole support function.

Is it planned? Possible at all.

Thank you for a extremly good job!!

Abe1
08-03-2006, 08:06 PM
Hi Abe.

I know. Here's another one asking for the attachment. I sure would help a lot if it would be able to attach files.

I will use the form in a support function and if the user won't be able to send pictures of their problems.. then it would be a whole support function.

Is it planned? Possible at all.

Thank you for a extremly good job!!
Maybe in the vb 3.6 version.

Kungfu
08-05-2006, 03:20 AM
Question, i have it setup to make a new thread everytime. Well if what they put into the longbox is too long it wont post the new thread. Anyway to split up the thread into multiple posts inside the thread if its too long or at least notify the user that it was too long?

Also i notice a lot people ask about how to get usernames emails etc... Maybe it should be added in an example somewhere.
$bbuserinfo = $vbulletin->userinfo;
then use $bbuserinfo[choose an one of the user infos below]

Example
$bbuserinfo[userid]
or
$bbuserinfo[username]
etc...

userid
usergroupid
membergroupids
displaygroupid
username
password
passworddate
email
styleid
parentemail
homepage
icq
aim
yahoo
msn
skype
showvbcode
showbirthday
usertitle
customtitle
joindate
daysprune
lastvisit
lastactivity
lastpost
posts
reputation
reputationlevelid
timezoneoffset
pmpopup
avatarid
avatarrevision
profilepicrevision
options
birthday
birthday_search
maxposts
startofweek
ipaddress
referrerid
languageid
emailstamp
threadedmode
autosubscribe
pmtotal
pmunread

mschvili
08-08-2006, 02:51 PM
Since I use the form as a support form I want to use the same form for several forums (about 30).

As soon as the user select the add thread button in those forum you should get the forum.

Sound logical, doesn't it :-)

Super hack by the way!!

Murty
08-09-2006, 06:23 AM
just installed this, an i fully cant figure out how to put in more radio buttons for some questions and take out other defualt questions, can you refer me to a post or gimme something to work with? thanks.

ProperMethodz
08-09-2006, 12:55 PM
I'm currently working on a Horde specific WoW application form. Is it alright if I posted it as my own but referenced this thread? I'm putting a lot of work into it and have already spent about 20 hours total on it.

ProperMethodz
08-10-2006, 03:59 PM
Abe, first off... Awesome hack. This has taught me a lot about how vb works and how to customize a lot of different things I had never tried.

On to my problem. As you can see in my previous post, I've been working on a form. So far it's a pretty intensive, well intensive for me, form.

I started with getting all the information on the page by copy and pasting code then changing the function name, value and name variables to fit the layout I needed. I then went down to the customize area and put in the questions and answers I wanted.

The last part before I want to mess with any of the permissions is the template and Variables. See before I started messing with the variables, only some of my answers would come out. So I looked back and found that I was missing some information there. So I started customizing all the variables and am afraid I mesed up royaly because now... no answers show in the PM/E-mail/Thread creation.

Please tell me what the heck I did wrong... I don't get it. I mimicked what you did :(.


Here's the template code:

<template name="formanswers" templatetype="template" date="1149082732" username="ProperMethodz" version="3.5.4"><![CDATA[$formtitle
$bbuserinfo[username]

$question1
$answer1

$question2
$answer2

$question3
$answer3
-------------------------------------------------

$question4
$answer4

$dropdownquestion1
$dropdownanswer1

$dropdownquestion2
$dropdownanswer2

$questionlevel
$answerlevel

$dropdownquestion3
$dropdownanswer3

$dropdownquestion4
$dropdownanswer4 $dropdownanswer4a

$dropdownquestion5
$dropdownanswer5 $dropdownanswer5a

$question5
$answer5

$question7
$answer7

$checkboxquestion1
$checkboxanswer1_1
$checkboxanswer1_2
$checkboxanswer1_3
$checkboxanswer1_4
$checkboxanswer1_5
$checkboxanswer1_6
$checkboxanswer1_7
$checkboxanswer1_8
$checkboxanswer1_9
$checkboxanswer1_10
$checkboxanswer1_11
$checkboxanswer1_12
$checkboxanswer1_13
$checkboxanswer1_14
$checkboxanswer1_15

$radioquestion1
$radioanswer1

$radioquestion2
$radioanswer2

$question8
$answer8

$question6
$answer6a
$answer6b
$answer6c

$vbtextquestion1
------------------------------------------------------

$vbtextanswer

------------------------------------------------------
$vbtextquestion2
------------------------------------------------------

$vbtextanswer2

------------------------------------------------------]]></template>

Here's the variable code:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'$answer1' => TYPE_STR,
'$answer2' => TYPE_STR,
'$answer3' => TYPE_STR,
'$answer4' => TYPE_STR,
'$dropdownanswer1' => TYPE_STR,
'$dropdownanswer2' => TYPE_STR,
'$answerlevel' => TYPE_STR,
'$dropdownanswer3' => TYPE_STR,
'$dropdownanswer4' => TYPE_STR,
'$dropdownanswer4a' => TYPE_STR,
'$dropdownanswer5' => TYPE_STR,
'$dropdownanswer5a' => TYPE_STR,
'$answer5' => TYPE_STR,
'$answer7' => TYPE_STR,
'$checkboxanswer1_1' => TYPE_STR,
'$checkboxanswer1_2' => TYPE_STR,
'$checkboxanswer1_3' => TYPE_STR,
'$checkboxanswer1_4' => TYPE_STR,
'$checkboxanswer1_5' => TYPE_STR,
'$checkboxanswer1_6' => TYPE_STR,
'$checkboxanswer1_7' => TYPE_STR,
'$checkboxanswer1_8' => TYPE_STR,
'$checkboxanswer1_9' => TYPE_STR,
'$checkboxanswer1_10' => TYPE_STR,
'$checkboxanswer1_11' => TYPE_STR,
'$checkboxanswer1_12' => TYPE_STR,
'$checkboxanswer1_13' => TYPE_STR,
'$checkboxanswer1_14' => TYPE_STR,
'$checkboxanswer1_15' => TYPE_STR,
'$radioanswer1' => TYPE_STR,
'$radioanswer2' => TYPE_STR,
'$answer8' => TYPE_STR,
'$answer6a' => TYPE_STR,
'$answer6b' => TYPE_STR,
'$answer6c' => TYPE_STR,
'$vbtextanswer' => TYPE_STR,
'$vbtextanswer2' => TYPE_STR
));

// Part 2
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$answer4 = $vbulletin->GPC['answer4'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$dropdownanswer2 = $vbulletin->GPC['dropdownanswer2'];
$answerlevel = $vbulletin->GPC['answerlevel'];
$dropdownanswer3 = $vbulletin->GPC['dropdownanswer3'];
$dropdownanswer4 = $vbulletin->GPC['dropdownanswer4'];
$dropdownanswer4a = $vbulletin->GPC['dropdownanswer4a'];
$dropdownanswer5 = $vbulletin->GPC['dropdownanswer5'];
$dropdownanswer5a = $vbulletin->GPC['dropdownanswer5a'];
$answer5 = $vbulletin->GPC['answer5'];
$answer7 = $vbulletin->GPC['answer7'];
$checkboxanswer1_1 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_2 = $vbulletin->GPC['checkboxanswer1_2'];
$checkboxanswer1_3 = $vbulletin->GPC['checkboxanswer1_3'];
$checkboxanswer1_4 = $vbulletin->GPC['checkboxanswer1_4'];
$checkboxanswer1_5 = $vbulletin->GPC['checkboxanswer1_5'];
$checkboxanswer1_6 = $vbulletin->GPC['checkboxanswer1_6'];
$checkboxanswer1_7 = $vbulletin->GPC['checkboxanswer1_7'];
$checkboxanswer1_8 = $vbulletin->GPC['checkboxanswer1_8'];
$checkboxanswer1_9 = $vbulletin->GPC['checkboxanswer1_9'];
$checkboxanswer1_10 = $vbulletin->GPC['checkboxanswer1_10'];
$checkboxanswer1_11 = $vbulletin->GPC['checkboxanswer1_11'];
$checkboxanswer1_12 = $vbulletin->GPC['checkboxanswer1_12'];
$checkboxanswer1_13 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_14 = $vbulletin->GPC['checkboxanswer1_14'];
$checkboxanswer1_15 = $vbulletin->GPC['checkboxanswer1_15'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$radioanswer2 = $vbulletin->GPC['radioanswer2'];
$answer8 = $vbulletin->GPC['answer8'];
$answer6a = $vbulletin->GPC['answer6a'];
$answer6b = $vbulletin->GPC['answer6b'];
$answer6c = $vbulletin->GPC['answer6c'];
$vbtextanswer = $vbulletin->GPC['vbtextanswer'];
$vbtextanswer2 = $vbulletin->GPC['vbtextanswer2'];

R.Caldwell
08-22-2006, 09:38 PM
Just wondering if anyone can help me add a drop down box for the user to select which thread he wants the form to be submited to.

I really like this hack, and I can pay someone for the added support if needs be.

Nuguru
08-22-2006, 11:09 PM
Hello Everyone,

I got to start out by thanking the developer of this form, as it seems to has lots of potential.

However, I am having a little problem with it's spacing and I am hoping that someone could help me out here.

I just installed it on vbulletin 3.5.4 and I am getting a extra space at the top of it. The extra space is below the navbar before the form (Please see attachment).

It looks like a <br> of some type needs to be removed, but I can't seem to find the code that will take out this extra space.

Any help would be appreciated.


Thank You,

Nuguru :)

evofile
08-23-2006, 12:26 AM
is that hack works on vBulletin 3.6.0?

mschvili
08-23-2006, 03:50 AM
Nuguru, you need to go in and change to Template under 'Style'. The template is called "Form".