PDA

View Full Version : New Posting Features - Form Hack


Pages : [1] 2 3 4 5 6

Abe1
09-14-2006, 10:00 PM
Form Hack 4.1


Features:

Ever wanted an online form that a user can fill out, which when submitted gets:

Posted into a new thread in a forum of your choice
Create a new poll in the new thread with options of your choice
Posted as a reply in an existing thread of your choice
PMed to you or someone else
Emailed to an email address you specify
Choose to redirect to the post, thread or forum, or a custom thank you message
Choose to redirect to edit post
See a preview before they submit

Or any combination or all of the above?

Well, this is the hack for you!

You can use this for:

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

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

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

Format of the form:

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

This is customizable via the hook.

Also:

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

INSTALLATION
Easy - takes only a few minutes:

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

Done!

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

Enjoy!

Updates:

Version 4.0: (09/15/2006)

Ported over for vb3.6
Send to multiple emails.
Send multiple PMs.
Parse emails for BBCode
And finally, ATTACHMENTS!


Version 4.1: (04/24/2008)

Fixed for vb 3.6.10
Small bug fixed.
List of the 2 quick edits are in the zip file so you don't have to start making a form from scratch.


MAKE SURE YOU CLICK INSTALL (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=126676)!
You will get an email when a new version is released.

Abe1 with rights from Dr Erwin Loh

flomsen
09-15-2006, 06:43 AM
1000 thx, just what i have wating for :)


how can user set there owns Title: ? now it show Generic Form

and i need some help to add a form to set in picture link, and that will show pic in post.


sorry for my english


/Flomsen

Hornstar
09-15-2006, 07:57 AM
Yeah i think i remember your old one of this, it was really good. Thanks.

Spinball
09-15-2006, 08:18 AM
Thanks Abe.
Question, though. Despite uploading an attachment, it isn't appearing in the post. What can I do to track down the problem?

Lizard King
09-15-2006, 10:37 AM
Nice hack Abe :)

Reece^B
09-15-2006, 10:52 AM
Great Hack.

beduino
09-15-2006, 11:43 AM
tks abe1!!!!!!!!
all the best
beduino
ps. why i can't 'nominated this hack' when i click in link? :(

Abe1
09-15-2006, 11:44 AM
tks abe1!!!!!!!!
all the best
beduino
ps. why i can't 'nominated this hack' when i click in link? :(
You can only nominate once a month. Feel free to do it next month.

Abe1
09-15-2006, 11:45 AM
Thanks Abe.
Question, though. Despite uploading an attachment, it isn't appearing in the post. What can I do to track down the problem?
There are 2 template edits to make the attachements work. Make sure you did both. You can also test it by clicking 'preview'.

Snake
09-15-2006, 12:39 PM
Just what I was looking for.

mschvili
09-15-2006, 12:54 PM
Wow. You're the man, Abi. Now I can start up my support service. Been wating for this update first.

A question, I don't want to go through an update of our vBulletin yet. So, would v4.0 Form Hack work also on vBulletin v3.5?

Matti.

|oR|Greg
09-15-2006, 01:04 PM
Important FYI - If you have "Guest Post Image Verification" turned on, posting to a thread will not work because the form hack doesn't integrate the Image Verification system.

|oR|Greg
09-15-2006, 01:32 PM
Oh and attachments don't work for unregistered users.

Abe1
09-15-2006, 01:55 PM
Wow. You're the man, Abi. Now I can start up my support service. Been wating for this update first.

A question, I don't want to go through an update of our vBulletin yet. So, would v4.0 Form Hack work also on vBulletin v3.5?

Matti.
I'm not sure. The attachment structure may be differant.

|oR|Greg
09-15-2006, 02:21 PM
Abe, How do I format the results of the form without allowing the use of HTML in threads? I want to bold the questions once it's posted to the thread and of course in the preview... but I can't use BBCode in a template, and HTML in the form doesn't display in the thread... ?

|oR|Greg
09-15-2006, 02:57 PM
Also, when I turn on the variable to require that all questions are answered... even though I answer them all, it tells me I haven't.

Nuguru
09-15-2006, 03:14 PM
Helly Everyone,

It's great to hear that Form Hack now has the ability to accept attachments on this new update but I am running vb 3.5.4. and intend on staying with this vb version for a while.

Can this updated version work on vb 3.5.4.? If not, can you update a version of Form Hack to work with vb 3.5.4. because I really like this mod but would like it to be able to allow attachments?



Thank You,


Nuguru :)

Abe1
09-15-2006, 05:08 PM
Abe, How do I format the results of the form without allowing the use of HTML in threads? I want to bold the questions once it's posted to the thread and of course in the preview... but I can't use BBCode in a template, and HTML in the form doesn't display in the thread... ?
You can use BBCode in the answer template. Just make sure the end of a varable not is next to a bbcode.

Abe1
09-15-2006, 05:10 PM
Also, when I turn on the variable to require that all questions are answered... even though I answer them all, it tells me I haven't.
If you removed any of the defaut test, you have to remove the varibles from the check also.

Also, the vb editor back automaticlly check to make sure you have the min. amount of car. in the box.

Abe1
09-15-2006, 05:11 PM
Helly Everyone,

It's great to hear that Form Hack now has the ability to accept attachments on this new update but I am running vb 3.5.4. and intend on staying with this vb version for a while.

Can this updated version work on vb 3.5.4.? If not, can you update a version of Form Hack to work with vb 3.5.4. because I really like this mod but would like it to be able to allow attachments?



Thank You,


Nuguru :)
I'm not sure if the attahments work the same in vb3.5 as they do in vb3.6. You would have to copy the plug-in and template and test it out.

RMS-Chef
09-15-2006, 06:39 PM
Thanks for the update Abe.
I have no use for attachments with my forms so I am sticking to the previous v3.5.x release with my v3.6.x forum. It's working fine.

dirtycrow
09-15-2006, 07:08 PM
hmmm. . . what am i doing wrong?

i wanted to get rid of all the radio buttons and drop downs.

|oR|Greg
09-15-2006, 07:19 PM
You have to edit the hook, and both templates in order to make it work.

dirtycrow
09-15-2006, 07:23 PM
also, i was wondering, if i wanted to use this as a order form, where would I enter the code for a paypal button?

dirtycrow
09-15-2006, 07:29 PM
You have to edit the hook, and both templates in order to make it work.

both templates? but what happens when i create more then one form?

i followed the directions "// 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."

dirtycrow
09-15-2006, 07:33 PM
wait. . . i have to change the templates for form and form answer? but then all my forms from the point would have to have the same lay out?

dirtycrow
09-15-2006, 07:50 PM
never mind, i got it.

this is an EXCELLENT! mod, not the freindliest to create new forms, but it is perfect for what i needed. thank you!

Abe1
09-15-2006, 08:09 PM
Thanks for the update Abe.
I have no use for attachments with my forms so I am sticking to the previous v3.5.x release with my v3.6.x forum. It's working fine.
There is an option in the plug-in to enable or disable attachments.

Wired1
09-15-2006, 08:23 PM
I realize this may be out of the scope of this hack, or maybe in its future, but it can't hurt to ask:

Would it be possible to add on to this where there is an additional button on the postbit (say, net to reply) or maybe one on the threadbit (?) where a user (preferably the thread creator or the post creator) can hit a button (linked to the form) that passes the post id or thread id to the form so that it is passed on to the end recipient (in my case, it would be for emails only).

This way the recipient would be able to reference the post / thread id, which may contain more information than what is included in the form.

If this is something outside of the future scope of the form, or not to be included in an upgrade, would you mind if I created an add-on to your hack to enable this functionality?

Abe1
09-15-2006, 08:46 PM
I realize this may be out of the scope of this hack, or maybe in its future, but it can't hurt to ask:

Would it be possible to add on to this where there is an additional button on the postbit (say, net to reply) or maybe one on the threadbit (?) where a user (preferably the thread creator or the post creator) can hit a button (linked to the form) that passes the post id or thread id to the form so that it is passed on to the end recipient (in my case, it would be for emails only).

This way the recipient would be able to reference the post / thread id, which may contain more information than what is included in the form.

If this is something outside of the future scope of the form, or not to be included in an upgrade, would you mind if I created an add-on to your hack to enable this functionality?
Look at my sig. I have a hack that lets you edit the "new thread" link.

Wired1
09-15-2006, 09:05 PM
Look at my sig. I have a hack that lets you edit the "new thread" link.sorry, I'm not seeing the link you mean.

Wongod
09-15-2006, 09:07 PM
I just installed the hack but the attachments part of the form is failing. I found that it's failing this check: if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] AND $vbulletin->userinfo['userid'] AND !empty($vbulletin->userinfo['attachmentextensions']))

What do I need to configure in order to make that statement true? I am able to post attachments in a regular "newthread" so it seems that it should be configured correctly as far as that goes...

Abe1
09-15-2006, 09:34 PM
sorry, I'm not seeing the link you mean.
https://vborg.vbsupport.ru/showthread.php?t=102923

Abe1
09-15-2006, 09:34 PM
I just installed the hack but the attachments part of the form is failing. I found that it's failing this check: if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] AND $vbulletin->userinfo['userid'] AND !empty($vbulletin->userinfo['attachmentextensions']))

What do I need to configure in order to make that statement true? I am able to post attachments in a regular "newthread" so it seems that it should be configured correctly as far as that goes...
I'll have a look at the code.

Wired1
09-15-2006, 09:35 PM
I see it now (was only looking under vB 3.6), however it's not what I'm looking for. I definitely want users to create threads and posts, but then once an admin has approved it (just a verbal OK in the thread, no need to check it in any fashion), they can hit a button and it will open a new form up and preferably pre-fill it out with the post or thread ID. There's some other stuff I'd want to pre-load, but that's something I'll have to modify on my own.

camuca
09-16-2006, 03:50 AM
Hi, this is a very good work.

How would I implement a drop down box that would show list of the forums and allow user to post the form to.

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

It will be something like $formforumid = Dropdown code that shows all the forums which are then converted to ids, I guess

Any suggestions how this can be implemented

Wired1
09-16-2006, 04:59 AM
Can anyone help me out wit this code?May want to be more specific as to what you actually need help with.

bandare
09-16-2006, 11:24 AM
is there a demo anywhere to see please?

Spinball
09-16-2006, 04:24 PM
There are 2 template edits to make the attachements work. Make sure you did both. You can also test it by clicking 'preview'.
I put the attachment text into the form template.
Which other template, please? (I looked at formanswers but there is no sign of the attachment in there).

FSFwebmaster
09-16-2006, 06:09 PM
need help adding more questions to the default number of questions?

The-Ensemble
09-16-2006, 07:29 PM
Can you create Multiple forms with this?

Spinball
09-16-2006, 09:08 PM
Can you create Multiple forms with this?
Yes, you have to create a different form (and formanswers) template and also a plugin product for each one.

FSFwebmaster
09-17-2006, 12:13 AM
for some reason if i add more than 3 questions they dont show up any idea why ? this part of the form

$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 online game name?";
$explain2 = "Please enter your online game name 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 birth date?";
$explain3 = "Please enter your birthe date here.";

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

Abe1
09-17-2006, 02:58 AM
for some reason if i add more than 3 questions they dont show up any idea why ? this part of the form

$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 online game name?";
$explain2 = "Please enter your online game name 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 birth date?";
$explain3 = "Please enter your birthe date here.";

//QUESTION 4 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question4 = "What is your email address?";
$explain4 = "Please enter your email address here.";
YOu have to edit the template also.

Spiffware
09-17-2006, 05:31 AM
nice work thanks i like it alot

Limerick
09-17-2006, 06:54 AM
Hello Abe,

Thank you very much for your hack which will be useful for many of us.

I'd like to know if your hack could be used in a way I've described here (https://vborg.vbsupport.ru/showthread.php?t=126146), and what changes would it need ?

Note that what I described there was just an idea, but your design seems to be as convenient.

Spinball
09-17-2006, 07:54 AM
Hi Abe,
I have modified the form to allow the attachements, and that works (in that it allows me to add attachments). I have also re-modified the formanswers template from the original, although I don't see any reference to attachments in that.
No attachments are appearing in the preview. What am I doing wrong, please?

The-Ensemble
09-17-2006, 09:52 AM
Yes, you have to create a different form (and formanswers) template and also a plugin product for each one.
ok, that sounds kinda hard. Do I just alter the original plugin product and change a few things?
If so what things?

aceofspades
09-17-2006, 10:05 AM
Can you please help me, i am getting this error message:

Fatal error: Existing data passed is not an array
Called set_existing in /home/hiven48/public_html/forums/newthread.php(70) : eval()'d code on line 411
Called eval in /home/hiven48/public_html/forums/newthread.php on line 70
in /includes/class_dm.php on line 235


I have only changed the titles of the questions, i havent changed anything else.

The-Ensemble
09-17-2006, 11:18 AM
Ignore my previous question. I just found the instructions lol

ETA: Can the form be customised to have a lot of input box and fields?

ETA (again): How would I change the navbar in php? I want it so it says
board name - usercp - usercp page - form

Does this (the questions etc.) have to be done in php? can't it be done in the template?

any idea?

zafrir
09-17-2006, 12:16 PM
Can I use the hack to creat a vbulletin.org style threads?

I want to enable a specific usergroup to use the form for the first post of a thread (post a software review in my case in a predefined format) and then enable all other users to reply to that post.

How the edit post is done?? will I be able to use the form to edit posts done with the form.

The-Ensemble
09-17-2006, 03:07 PM
Oh and I want to remove the toolbar and stuff from around the message area how would I do that? Because I can't see it anywhere where it says to do that. . .

Limerick
09-17-2006, 03:09 PM
Hello Abe,

Thank you very much for your hack which will be useful for many of us.

I'd like to know if your hack could be used in a way I've described here (https://vborg.vbsupport.ru/showthread.php?t=126146), and what changes would it need ?

Note that what I described there was just an idea, but your design seems to be as convenient.

Ok I've installed the hack so I guess it would be possible to reach my goal.
Unfortunately, I think it would be to hard for me.

But, most of all, it would need, IMHO, just one improvement.

It should be possible to call this hack from an existing thread with a special button like "Post Reply" or "New Thread", which could be named "Quote a received e-mail"

Spinball
09-17-2006, 03:27 PM
Oh god! Upgraded forum to 3.6.1 and now getting this error when posting the form:
Warning: Cannot use a scalar value as an array in /incoudes/functions_newpost on line 352

The-Ensemble
09-17-2006, 03:51 PM
what does it say on 352 of that file?

R.Caldwell
09-17-2006, 11:58 PM
Hi, this is a very good work.

How would I implement a drop down box that would show list of the forums and allow user to post the form to.

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


It will be something like $formforumid = Dropdown code that shows all the forums which are then converted to ids, I guess

Any suggestions how this can be implemented

I could use some help with this section of the form as well.

Spinball
09-18-2006, 05:28 AM
what does it say on 352 of that file?
($hook = vBulletinHook::fetch_hook('newpost_process')) ? eval($hook) : false;

Abe1
09-18-2006, 12:20 PM
Hi Abe,
I have modified the form to allow the attachements, and that works (in that it allows me to add attachments). I have also re-modified the formanswers template from the original, although I don't see any reference to attachments in that.
No attachments are appearing in the preview. What am I doing wrong, please?
Attachments dont show up on the preview but are still there when you click preview.

ctrl-alt-del
09-18-2006, 01:43 PM
What an excellent hack!! I'll need to install this and start testing. Thanks!!

The-Ensemble
09-18-2006, 02:49 PM
($hook = vBulletinHook::fetch_hook('newpost_process')) ? eval($hook) : false;
Hopefully the coder will know whats wrong with this, because I don't sorry :(

-----
Has their been any idea how any of these can be done?

ETA (again): How would I change the navbar in php? I want it so it says
board name - usercp - usercp page - form

Does this (the questions etc.) have to be done in php? can't it be done in the template?

Also How would I make the box's bigger? I've tried in the templates and it doesnt change, how would I do it in php?

any idea?

Thanks

Wongod
09-18-2006, 03:59 PM
Hey Abe,

Any progress on this? Thanks =)

I'll have a look at the code.

Roxie
09-18-2006, 04:16 PM
Ahhh. Just what I need!

Thanks.

zafrir
09-18-2006, 06:26 PM
Personally I see this as one of the great hacks....
next step should be someone rais it to the next level by
writing an external wysiwyg editor enhancement to
auto generate the forms and proper hooks and answer pages.

Z

ctrl-alt-del
09-18-2006, 07:15 PM
How can I use BB code for formanswers?? Can I get an example?

In other words,
I want the question headings to be bold when posted to a thread.

R.Caldwell
09-18-2006, 07:19 PM
How can I use BB code for formanswers?? Can I get an example?

In other words,
I want the question headings to be bold when posted to a thread.

in the formanswers template, make your code look like this

$formquestion - Note the spaces in between the

Abe1
09-18-2006, 07:26 PM
You can also do this:

$formquestion

or
$formquestion
$formquestion

ctrl-alt-del
09-18-2006, 07:31 PM
Thanks, I tried the obvious, but received an error message. I'll try the suggestions above.

ctrl-alt-del
09-18-2006, 08:06 PM
A WYSIWYG editor would put this hack over the top!

I have yet another question I'm hoping be answered with relative ease. Is it possible to add a drop down menu to a form that posts either a new thread or reply to a thread in a specific form based on the selection of the drop down?

Example: Selections could be The Lounge, vBulletin Discussions, Service Requests, etc. Submitting the form would create the thread in the drop down selection. Thanks!!

ctrl-alt-del
09-18-2006, 08:22 PM
I imagine it's not as simple as:

$formforumid = "$dropdownanswer1";

I need a way of associating the selection to a forumID. Thanks again!

The-Ensemble
09-18-2006, 09:25 PM
Ok, My forms are done I just need this edit and then I'm tottally done.

How would I change the navbar in php? I want it so it says
board name - usercp - usercp page - form

R.Caldwell
09-18-2006, 11:40 PM
I imagine it's not as simple as:

$formforumid = "$dropdownanswer1";

I need a way of associating the selection to a forumID. Thanks again!
I've tried various ways of getting this to work, and all I get is some wierd errors...

I have PM'd Abe1, but have yet to hear anything back.
If you would like to Collab on it, let me know.

Abe1
09-19-2006, 02:59 AM
A WYSIWYG editor would put this hack over the top!

I have yet another question I'm hoping be answered with relative ease. Is it possible to add a drop down menu to a form that posts either a new thread or reply to a thread in a specific form based on the selection of the drop down?

Example: Selections could be The Lounge, vBulletin Discussions, Service Requests, etc. Submitting the form would create the thread in the drop down selection. Thanks!!
There is a WYSIWYG editor already.

Abe1
09-19-2006, 02:59 AM
I've tried various ways of getting this to work, and all I get is some wierd errors...

I have PM'd Abe1, but have yet to hear anything back.
If you would like to Collab on it, let me know.
I dont have time to write up all the info. Basicly make sure you are using the right varible. It has to be imported the same way as all other answers are imported.

ctrl-alt-del
09-19-2006, 03:00 AM
Yes, I meant for the forms.

Abe1
09-19-2006, 03:02 AM
Yes, I meant for the forms.
There is a WYSIWYG editor in the form. What are you talking about????

ctrl-alt-del
09-19-2006, 03:07 AM
:) Apologies, we're missing each other....I know there's a WYSIWYG editor when you're entering/submitting information within a form. But it would be great to have one when creating the forms. (form and formanswers in addition to the separate plugin/hook that needs to be created)

I know it's probably a huge task to undergo something like this.

Can you help us figure out the drop down box question?

R.Caldwell
09-19-2006, 01:33 PM
so I need to have the forumID in the answer templates?

I didn't put it in there because I thought it wouldnt matter, I will try what I was doing last time and see if I can get it to work.

UManiac
09-20-2006, 03:53 AM
Does this ONLY work on 3.6?

Abe1
09-20-2006, 10:05 AM
Does this ONLY work on 3.6?
I think if you try to import this into vb3.5 you may get an error.

Also, I'm not sure the attachments work the same in vb 3.5

R.Caldwell
09-20-2006, 01:33 PM
Ok, I have tried just about everything I can think of, I get these errors when submitting -

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

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 763


This happens when I have send PM enabled. With my addon's for the drop down forum menu.

Here is a snip of my code I have on my form now.


// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'dropforum1' => TYPE_STR,
'dropforum2' => TYPE_STR,


There is more code after this, this is only the relevent selections.


// Part 2
$dropforum1 = $vbulletin->GPC['dropforum1'];
$dropforum2 = $vbulletin->GPC['dropforum2'];


There is more code after this, this is only the relevent selections.


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

$dropforum1 = "2";
$dropforum2 = "4";


Form Template additions

<tr>
<td class="alt1" valign="middle">
<b>$dropdownforum1</b>:
<td class="alt1" valign="middle" colspan="2">
<select name="dropdownforum1">
<option value="$dropdownforum1" <if condition="$dropdownforum1 == $dropforum1">selected="selected"</if>>$dropforum1</option>
<option value="$dropdownforum1" <if condition="$dropdownforum1 == $dropforum2">selected="selected"</if>>$dropforum2</option>
</select></td>
</td>
</tr>


Form Answers template

$dropdownforum1
$dropforum1
$dropforum2


I dont know why it isn't working, I'm sure its something small I have missed, I am using Drop Down choices throughout the form, so I know my coding is correct for that on my form. I'm just not sure where I missed something or what, but maybe this can help someone else out.

I'm also willing to pay for service to help me get this form working with the Drop Down Choice for which form to post to.

The-Ensemble
09-20-2006, 02:39 PM
Ok, My forms are done I just need this edit and then I'm tottally done.

How would I change the navbar in php? I want it so it says
board name - usercp - usercp page - form

ReBumping my question :D

R.Caldwell
09-20-2006, 03:29 PM
You could try adding this to the navbar template in your style

<if condition="$show['member']">
<td class="vbmenu_control"><a href="newthread.php?do=service_form">$vbphrase[Form]</a></td>
</if>

aceofspades
09-20-2006, 03:48 PM
Can you please help me, i am getting this error message:



I have only changed the titles of the questions, i havent changed anything else.

Are you able to help me with this?

James

R.Caldwell
09-20-2006, 06:15 PM
Are you able to help me with this?

James
When you change the title of the questions, you need to make the same changes to the form template and formanswers template.

Make sure whatever questions you changed are in the Part 1 & 2 Varibles list as well.

Abe1
09-20-2006, 07:36 PM
When you change the title of the questions, you need to make the same changes to the form template and formanswers template.

Make sure whatever questions you changed are in the Part 1 & 2 Varibles list as well.
Only if you cahnge the var. name or add, or delete do you have to edit part 1, part 2, and both templates.

R.Caldwell
09-20-2006, 08:06 PM
Abe1 - Is there a way to you can at least tell me the varible(s) i need to change? I know it's something small I am missing.

JAuthement
09-20-2006, 09:16 PM
Abe1,

For us the "Programming Illiterate" is there a way that you can upgrade the mod so that it is more "User Friendly"? for example make it so that the layout and questions can be edited within a options page basically make it "Point and Click". Reasoning for this is that I've tried to configure this as an Application form. I had no need for a normal answer variable but instead I needed another dropdown. For the life of me I could not get rid of the input box for $normalquestion1, I could not get the dropdown to present itself where I wanted it, and I couldn't get both dropdown's to be visable on the page. I went as far as to create an additional variable and sequetially numbered it (i.e. $dropdownanswer1 and $dropdownanswer2) but with no success.

I see this mod as a valuable asset to my site but my limited expertise in programming ( expertiese scale 1 - 10 MINE - neg 5,000) renders it useless at the moment.

Abe1
09-20-2006, 11:51 PM
Abe1,

For us the "Programming Illiterate" is there a way that you can upgrade the mod so that it is more "User Friendly"? for example make it so that the layout and questions can be edited within a options page basically make it "Point and Click". Reasoning for this is that I've tried to configure this as an Application form. I had no need for a normal answer variable but instead I needed another dropdown. For the life of me I could not get rid of the input box for $normalquestion1, I could not get the dropdown to present itself where I wanted it, and I couldn't get both dropdown's to be visable on the page. I went as far as to create an additional variable and sequetially numbered it (i.e. $dropdownanswer1 and $dropdownanswer2) but with no success.

I see this mod as a valuable asset to my site but my limited expertise in programming ( expertiese scale 1 - 10 MINE - neg 5,000) renders it useless at the moment.
I am a programmer, not an English teacher. I don't have patients to write everything up perfectly. The hardest part about programming is to explain to users how to use it. If someone is willing to be a middle man, be my guess and contact me.

ChrisBaktis
09-21-2006, 03:24 AM
I have my form posting as a thread - the members enter $normalanswer1 with the username of someone they trade with...when the form posts I want the title of the thread created to be the username of the person posting the form and $normalanswer1...

on the old version I think I did '$bbuserinfo[username] / $normalanswer1' but when I do that in the $posttitle part now the $bbuserinfo doesnt work...any suggestions?

R.Caldwell
09-21-2006, 04:23 AM
this code should work just fine in the hack code itself.

$posttitle = "$bbuserinfo[username]";

ChrisBaktis
09-21-2006, 04:41 AM
this code should work just fine in the hack code itself.

$posttitle = "$bbuserinfo[username]";


I tried that but it just left it out in the thread title

My $postitle code is = $bbuserinfo[username] / $normalanswer1

The thread that is created has a title that is this " / $normalanswer1" - the username doesnt show but the $normalanswer info does

R.Caldwell
09-21-2006, 04:43 AM
did you add it to the answers template?

The-Ensemble
09-21-2006, 05:49 AM
You could try adding this to the navbar template in your style

<if condition="$show['member']">
<td class="vbmenu_control"><a href="newthread.php?do=service_form">$vbphrase[Form]</a></td>
</if>


If this was to me, thank you but it needs to be done in php it doesnt do it in the template:(

ChrisBaktis
09-21-2006, 12:46 PM
did you add it to the answers template?

Yes and the answer template works fine...I have that same info in there where it works just as it did before - this is just in the Thread title that it isnt showing up.

The-Ensemble
09-21-2006, 03:45 PM
Hey,
I figured out how to edit breadcrum you simply remove the navbar part of the php code and your own but you can use the $formname part incase you change the form.

Thanks R.Caldwell I got the idea from what you said.

Deimos
09-21-2006, 11:53 PM
Great hack, smal.....large problem, heh

I've made it so there's 15 normal questions/answers, all of which show up on the original form
But, when you post or preview it, only the answer to the first question is posted?
It seems to ignore the other answers?
I must be missing something somewhere right?

ChrisBaktis
09-22-2006, 12:23 AM
I tried that but it just left it out in the thread title

My $postitle code is = $bbuserinfo[username] / $normalanswer1

The thread that is created has a title that is this " / $normalanswer1" - the username doesnt show but the $normalanswer info does

Any additonal suggestions on what the problem may be?

The-Ensemble
09-23-2006, 11:21 AM
Great hack, smal.....large problem, heh

I've made it so there's 15 normal questions/answers, all of which show up on the original form
But, when you post or preview it, only the answer to the first question is posted?
It seems to ignore the other answers?
I must be missing something somewhere right?
did you edit the forumanswers one so it shows all of them?


Ok now here's my question:
Someone filled out the form and pressed enter in a box and it submitted it, rather than create a new line how do I change this?

Martin-TMGRS
09-23-2006, 08:25 PM
I've tried editing the form, but when I view it there is all the old boxes left. I dont understand what i'm doing wrong. Can anyone help me out here please...See the attached file...

The-Ensemble
09-23-2006, 09:26 PM
did you edit the templates as well as the php code?

Martin-TMGRS
09-23-2006, 09:48 PM
did you edit the templates as well as the php code?
No I didn't but I have now, thanks for your help, many thanks :)

The-Ensemble
09-23-2006, 10:32 PM
No problem :D

Anyone on my problem? :(

thalamus
09-24-2006, 05:21 PM
I've set this up, and amended the file and templates to generate a Contact us function that is to be posted into a specified forum.

The form looks good, the information is great and it works wonderfully when posting into the forum... for those that have the relevant permissions...

Unfortunately, the form will be completed and submitted by unregistered members and I was wondering whether there's anything at all can be done to allow this to happen. The process is: guest or member (who generally doesn't have access to the forum into which its posted) completes a contact us form. It gets posted into the forum, and a "support" usergroup member responds or it's discussed.

Any clues as to where I should start looking for this solution?

edit: just saw this in the hack description:
"Depending on your forum permissions, if the new thread is in a public forum, members can reply to it. This hack allows a form to submit the new thread or post wherever you want it to go."
Well either I'm missing something completely obvious, or it simply doesn't do this. Unless it's this image verification thing that was mentioned a few pages back that's stopping it? I have it set to avoid spammage, so is that the problem I'm facing??

edit again: OK, just found that it *is* the image verification problem that was causing it. It now posts, but as Moderated - guess I'll have to tweak the forum/usergroup permissions to get around that. Just to confirm... by setting Guest Posts needs Image Verification to yes in your vb Options DOES cause this hack not to post into forums in those situations. Oh and the color red becomes green on these forums for some inexplicable reason...

ChrisBaktis
09-27-2006, 03:55 AM
I tried that but it just left it out in the thread title

My $postitle code is = $bbuserinfo[username] / $normalanswer1

The thread that is created has a title that is this " / $normalanswer1" - the username doesnt show but the $normalanswer info does

Still looking for support on this.

maroceve
09-27-2006, 11:17 AM
waaay too complicated for us non coders...not for me

thalamus
09-27-2006, 04:17 PM
Still looking for support on this.
You may have to set it up as a variable in the xml within the products manager - edit the Forms Hack in Products Manager, then under the VARIABLES section, put:
$user_name = $bbuserinfo[username];
then as your title put:
$user_name / $normalanswer1

Anyone have any idea as to how I can bypass the moderation queue when I post it into a "closed" forum?

ChrisBaktis
09-27-2006, 05:38 PM
You may have to set it up as a variable in the xml within the products manager - edit the Forms Hack in Products Manager, then under the VARIABLES section, put:

then as your title put:


Anyone have any idea as to how I can bypass the moderation queue when I post it into a "closed" forum?


I have this in my form hack and it is still a no go.

// Part 1
$user_name = $bbuserinfo[username];
$vbulletin->input->clean_array_gpc('p', array(
'normalanswer1' => TYPE_STR,
'radioanswer1' => TYPE_STR,
'radioanswer2' => TYPE_STR,
'radioanswer3' => TYPE_STR,
'radioanswer4' => TYPE_STR,
'radioanswer5' => TYPE_STR,
'radioanswer3other' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'checkboxanswer1_1' => TYPE_STR,
'checkboxanswer1_2' => TYPE_STR,
'checkboxanswer1_3' => TYPE_STR,
'longanswer1' => TYPE_STR,
'longanswer2' => TYPE_STR,
'longanswer3' => TYPE_STR
));

// Part 2
$user_name = $bbuserinfo[username];
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$radioanswer2 = $vbulletin->GPC['radioanswer2'];
$radioanswer3 = $vbulletin->GPC['radioanswer3'];
$radioanswer4 = $vbulletin->GPC['radioanswer4'];
$radioanswer5 = $vbulletin->GPC['radioanswer5'];
$radioanswer3other = $vbulletin->GPC['radioanswer3other'];
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$checkboxanswer1_1 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_2 = $vbulletin->GPC['checkboxanswer1_2'];
$checkboxanswer1_3 = $vbulletin->GPC['checkboxanswer1_3'];
$longanswer1 = $vbulletin->GPC['longanswer1'];
$longanswer2 = $vbulletin->GPC['longanswer2'];
$longanswer3 = $vbulletin->GPC['longanswer3'];

thalamus
09-27-2006, 06:41 PM
You don't need it in part 1, only part 2 where you're defining the variable. Also make sure you set your title to reflect the given variable $user_name

ChrisBaktis
09-27-2006, 07:35 PM
You don't need it in part 1, only part 2 where you're defining the variable. Also make sure you set your title to reflect the given variable $user_name

I really appreciate your help on this but it is still not working....here is my form maybe im messing something up somewhere.

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

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,
'radioanswer4' => TYPE_STR,
'radioanswer5' => TYPE_STR,
'radioanswer3other' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'checkboxanswer1_1' => TYPE_STR,
'checkboxanswer1_2' => TYPE_STR,
'checkboxanswer1_3' => TYPE_STR,
'longanswer1' => TYPE_STR,
'longanswer2' => TYPE_STR,
'longanswer3' => TYPE_STR
));

// Part 2
$user_name = $bbuserinfo[username];
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$radioanswer2 = $vbulletin->GPC['radioanswer2'];
$radioanswer3 = $vbulletin->GPC['radioanswer3'];
$radioanswer4 = $vbulletin->GPC['radioanswer4'];
$radioanswer5 = $vbulletin->GPC['radioanswer5'];
$radioanswer3other = $vbulletin->GPC['radioanswer3other'];
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$checkboxanswer1_1 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_2 = $vbulletin->GPC['checkboxanswer1_2'];
$checkboxanswer1_3 = $vbulletin->GPC['checkboxanswer1_3'];
$longanswer1 = $vbulletin->GPC['longanswer1'];
$longanswer2 = $vbulletin->GPC['longanswer2'];
$longanswer3 = $vbulletin->GPC['longanswer3'];

////////////////////////////////////////////////////////////////////////////////////////////////////
//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,22,13,27,33,9,28,31,24,19,15))) 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 = "tradeform";
// Name of the answer template
$answertemplate = "tradeformanswers";

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

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

//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 (separate multiple usernames with a ';')
$formpmname = "Abe";

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

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

//EMAIL ADDRESS TO EMAIL TO (separate multiple usernames with a ';')
$formemailaddress = "youremail@yourforums.com";

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

//ENABLE ATTACHMENTS - 1 = yes, 0 = no
//attachments can only be used if the form is going to make a new thread or post
$allow_attachments = "1";

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



////////////////////////////////////////////////////////////////////////////////////////////////////
//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 (thread or reply)
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption = "2";

$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 = "Sports Card Haven Trade Post 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 = "$user_name / $normalanswer1";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 allows you to easily post a trade with your trade partner. Please be sure to spell your trade partner's username correctly..";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Trade Partner's Username";

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

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

// 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 = "Delivery Confirmation?";

// The following choices must NOT have quotation marks
$radiochoice2a = "Yes";
$radiochoice2b = "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)
////////////////////////////////////////////////////////////////////////////////////////////////////

$radioquestion3 = "Bubble Mailer?";

// The following choices must NOT have quotation marks
$radiochoice3a = "Yes";
$radiochoice3b = "No";

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

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

$radioquestion4 = "Who Is Sending First??";

// The following choices must NOT have quotation marks
$radiochoice4a = "Me";
$radiochoice4b = "Trade Partner";
$radiochoice4c = "Same Time";

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

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

$radioquestion5 = "SCH Escrow Sale?";

// The following choices must NOT have quotation marks
$radiochoice5a = "Yes";
$radiochoice5b = "No";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Items Your Getting";
$longexplain1 = "List items that you are getting.";

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

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

$longquestion2 = "Trade Partner Gets";
$longexplain2 = "List items that you are sending.";

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

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

$longquestion3 = "Misc Info";
$longexplain3 = "Please post any additional information about this trade.";

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

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

$posthash = $vbulletin->input->clean_gpc('p', 'posthash', TYPE_NOHTML);
$poststarttime = $vbulletin->input->clean_gpc('p', 'poststarttime', TYPE_UINT);

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';
$newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

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";
$newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

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")
{
require_once(DIR . '/includes/class_bbcode_alt.php');
$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
$plaintext_parser->set_parsing_language($touserinfo['languageid']);
$formsend = $plaintext_parser->parse($formsend);

$emails = explode(';', $formemailaddress);
foreach ($emails AS $email)
{
vbmail($email, $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')
{
if (($formforum OR $formreply) AND $allow_attachments)
{
if ($formforum AND $formreply)
{
$forumid = $formforumid;
}
else if ($formreply)
{
$threadid = $formreplythreadid;
$threadinfo = verify_id('thread', $threadid, 0, 1);
$forumid = $threadinfo[forumid];
}
else
{
$forumid = $formforumid;
}

$forumperms = fetch_permissions($forumid);

// get attachment options
require_once(DIR . '/includes/functions_file.php');
$inimaxattach = fetch_max_upload_size();

$maxattachsize = vb_number_format($inimaxattach, 1, true);
$attachcount = 0;
$attach_editor = array();
$attachment_js = '';

if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] AND $vbulletin->userinfo['userid'] AND !empty($vbulletin->userinfo['attachmentextensions']))
{
if (!$posthash OR !$poststarttime)
{
$poststarttime = TIMENOW;
$posthash = md5($poststarttime . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']);
}
else
{
if (empty($postattach))
{
$currentattaches = $db->query_read("
SELECT dateline, filename, filesize, attachmentid
FROM " . TABLE_PREFIX . "attachment
WHERE posthash = '" . $db->escape_string($posthash) . "'
AND userid = " . $vbulletin->userinfo['userid']
);

while ($attach = $db->fetch_array($currentattaches))
{
$postattach["$attach[attachmentid]"] = $attach;
}
}

if (!empty($postattach))
{
foreach($postattach AS $attachmentid => $attach)
{
$attach['extension'] = strtolower(file_extension($attach['filename']));
$attach['filename'] = htmlspecialchars_uni($attach['filename']);
$attach['filesize'] = vb_number_format($attach['filesize'], 1, true);
$attach['imgpath'] = "$stylevar[imgdir_attach]/$attach[extension].gif";
$show['attachmentlist'] = true;
eval('$attachments .= "' . fetch_template('newpost_attachmentbit') . '";');

$attachment_js .= construct_attachment_add_js($attachmentid, $attach['filename'], $attach['filesize'], $attach['extension']);

$attach_editor["$attachmentid"] = $attach['filename'];
}
}
}

if ($threadid)
{
$attachurl = "t=$threadid";
}
else
{
$attachurl = "f=$forumid";
}
$newpost_attachmentbit = prepare_newpost_attachmentbit();
eval('$attachmentoption = "' . fetch_template('newpost_attachment') . '";');

if ($threadid)
{
$attach_editor['hash'] = $threadid;
$attach_editor['url'] = "newattachment.php?$session[sessionurl]t=$threadid&amp;poststarttime=$poststarttime&amp;posthash= $posthash";
}
else
{
$attach_editor['hash'] = $forumid;
$attach_editor['url'] = "newattachment.php?$session[sessionurl]f=$forumid&amp;poststarttime=$poststarttime&amp;posthash=$ posthash";
}
}
else
{
$attachmentoption = '';
}
}
else
{
$attachmentoption = '';
}

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

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

thalamus
10-01-2006, 08:29 AM
The only thing I can think of is that the initial variables are set when the action of the form is set to 'do form'... perhaps at the beginning of the script, where it says:
if ($_REQUEST['do'] == $formname)
{
add a "$bbuserinfo = $vbulletin->userinfo;" instruction just after the opening brace before it goes on to define the custom variables?

MRGTB
10-01-2006, 09:29 AM
this can be played around with to use as an article submission form etc. Quite neat.

ChrisBaktis
10-01-2006, 02:04 PM
The only thing I can think of is that the initial variables are set when the action of the form is set to 'do form'... perhaps at the beginning of the script, where it says:
if ($_REQUEST['do'] == $formname)
{
add a "$bbuserinfo = $vbulletin->userinfo;" instruction just after the opening brace before it goes on to define the custom variables?

YES!!! Thank you!

halpern
10-01-2006, 02:08 PM
Ok. I am not really a programmer so I am looking for some help. I have installed this into my Vbulletin 3.6.1. I want to have it email the results to the sysadmin, that would be me. What hook do I need to make the form? The default one is newthread_start but I am sure that I change that if I am sending a PM. Am I correct in saying that? Also, I do not have permission to view the thread that was created when I was testing the form. Why is this? I added id 6 in the array function to allow me (admin) access.

ChrisBaktis
10-02-2006, 12:43 AM
YES!!! Thank you!


spoke to soon - your suggestion solved teh problem but created another...

for some reason whenever a member clicked on a the New Thread button it went to the form... crazy I know...When I hover over the new thread button it didnt give that URL it gave teh URL for the new thread but when you clicked on it it goes to the form for some reason - I removed the line you gave me and that problem was corrected....this is the wierdest problem I have ever come across with a hack.

ChrisBaktis
10-02-2006, 12:46 AM
Corrected my own problem - originally I put the code before the { - I reread your post and realized I had to put it after it. Problem solved.

dieselpowered
10-02-2006, 10:36 PM
Alright, I must be a fool, however, I cannot get the form the way I want it.

I simply want to be able to make a form like this:

Year
Make
Model
Date
Text Box

All text areas...is this possible?

I tried to copy of couple of these but it did not work:

$normalquestion1 = "Year";

Sorry for the ignorance!

Shazz
10-03-2006, 03:39 AM
*Clicks install...
Ill try this out :)

ChrisBaktis
10-03-2006, 12:59 PM
Alright, I must be a fool, however, I cannot get the form the way I want it.

I simply want to be able to make a form like this:

Year
Make
Model
Date
Text Box

All text areas...is this possible?

I tried to copy of couple of these but it did not work:

$normalquestion1 = "Year";

Sorry for the ignorance!

Your variables would have to be like this:

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'normalanswer1' => TYPE_STR,
'normalanswer2' => TYPE_STR,
'normalanswer3' => TYPE_STR,
'normalanswer4' => TYPE_STR,
'longanswer1' => TYPE_STR

));

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



This will give you the 4 Nomral sized text boxes and then a big text area for your 5th item. You can just copy and paste the Normal Question area in the code and change the info in them.

Kayden
10-03-2006, 02:02 PM
Installed. Thanks.

Mirage Guardian
10-03-2006, 03:05 PM
after installing, I got a database error when I call "newthread.php?do=form"
Database error in vBulletin 3.6.1:

Invalid SQL:
SELECT * FROM forumpermission
WHERE ( forumid IN() AND usergroupid IN (6)) AND
(maxthread=0 AND perhour=0);

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND usergroupid IN (6)) AND
(maxthread=0 AND perhour=0)' at line 2
Error Number : 1064
The normal "newthread.php" syntax is:
http://my/forum/path/newthread.php?do=newthread&f=2
and when i call "newthread.php?do=form&f=2", the form start, but never submit and give the same database error.

What shall i do?

dieselpowered
10-03-2006, 06:55 PM
Your variables would have to be like this:

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'normalanswer1' => TYPE_STR,
'normalanswer2' => TYPE_STR,
'normalanswer3' => TYPE_STR,
'normalanswer4' => TYPE_STR,
'longanswer1' => TYPE_STR

));

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



This will give you the 4 Nomral sized text boxes and then a big text area for your 5th item. You can just copy and paste the Normal Question area in the code and change the info in them.
Ok I am officially a moron I guess.

I cannot get the form to do what I want it to, here is my code:

This is not how it should look! (http://www.xtremeoff-road.com/test/newthread.php?do=form)

// 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(
'normalanswer1' => TYPE_STR,
'normalanswer2' => TYPE_STR,
'normalanswer3' => TYPE_STR,
));

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "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 (separate multiple usernames with a ';')
$formpmname = "Abe";

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

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

//EMAIL ADDRESS TO EMAIL TO (separate multiple usernames with a ';')
$formemailaddress = "youremail@yourforums.com";

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

//ENABLE ATTACHMENTS - 1 = yes, 0 = no
//attachments can only be used if the form is going to make a new thread or post
$allow_attachments = "1";

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



////////////////////////////////////////////////////////////////////////////////////////////////////
//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 (thread or reply)
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption = "0";

$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 = "Test 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 = "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 = "Year";
$normalquestion2 = "Make";
$normalquestion3 = "Model";

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

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



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

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



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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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)
////////////////////////////////////////////////////////////////////////////////////////////////////


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


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

////////////////////////////////////////////////////////////////////////////////////////////////////
//CHECK BOX 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)
////////////////////////////////////////////////////////////////////////////////////////////////////



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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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)
////////////////////////////////////////////////////////////////////////////////////////////////////



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

$posthash = $vbulletin->input->clean_gpc('p', 'posthash', TYPE_NOHTML);
$poststarttime = $vbulletin->input->clean_gpc('p', 'poststarttime', TYPE_UINT);

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';
$newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

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";
$newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

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")
{
require_once(DIR . '/includes/class_bbcode_alt.php');
$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
$plaintext_parser->set_parsing_language($touserinfo['languageid']);
$formsend = $plaintext_parser->parse($formsend);

$emails = explode(';', $formemailaddress);
foreach ($emails AS $email)
{
vbmail($email, $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')
{
if (($formforum OR $formreply) AND $allow_attachments)
{
if ($formforum AND $formreply)
{
$forumid = $formforumid;
}
else if ($formreply)
{
$threadid = $formreplythreadid;
$threadinfo = verify_id('thread', $threadid, 0, 1);
$forumid = $threadinfo[forumid];
}
else
{
$forumid = $formforumid;
}

$forumperms = fetch_permissions($forumid);

// get attachment options
require_once(DIR . '/includes/functions_file.php');
$inimaxattach = fetch_max_upload_size();

$maxattachsize = vb_number_format($inimaxattach, 1, true);
$attachcount = 0;
$attach_editor = array();
$attachment_js = '';

if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] AND $vbulletin->userinfo['userid'] AND !empty($vbulletin->userinfo['attachmentextensions']))
{
if (!$posthash OR !$poststarttime)
{
$poststarttime = TIMENOW;
$posthash = md5($poststarttime . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']);
}
else
{
if (empty($postattach))
{
$currentattaches = $db->query_read("
SELECT dateline, filename, filesize, attachmentid
FROM " . TABLE_PREFIX . "attachment
WHERE posthash = '" . $db->escape_string($posthash) . "'
AND userid = " . $vbulletin->userinfo['userid']
);

while ($attach = $db->fetch_array($currentattaches))
{
$postattach["$attach[attachmentid]"] = $attach;
}
}

if (!empty($postattach))
{
foreach($postattach AS $attachmentid => $attach)
{
$attach['extension'] = strtolower(file_extension($attach['filename']));
$attach['filename'] = htmlspecialchars_uni($attach['filename']);
$attach['filesize'] = vb_number_format($attach['filesize'], 1, true);
$attach['imgpath'] = "$stylevar[imgdir_attach]/$attach[extension].gif";
$show['attachmentlist'] = true;
eval('$attachments .= "' . fetch_template('newpost_attachmentbit') . '";');

$attachment_js .= construct_attachment_add_js($attachmentid, $attach['filename'], $attach['filesize'], $attach['extension']);

$attach_editor["$attachmentid"] = $attach['filename'];
}
}
}

if ($threadid)
{
$attachurl = "t=$threadid";
}
else
{
$attachurl = "f=$forumid";
}
$newpost_attachmentbit = prepare_newpost_attachmentbit();
eval('$attachmentoption = "' . fetch_template('newpost_attachment') . '";');

if ($threadid)
{
$attach_editor['hash'] = $threadid;
$attach_editor['url'] = "newattachment.php?$session[sessionurl]t=$threadid&amp;poststarttime=$poststarttime&amp;posthash= $posthash";
}
else
{
$attach_editor['hash'] = $forumid;
$attach_editor['url'] = "newattachment.php?$session[sessionurl]f=$forumid&amp;poststarttime=$poststarttime&amp;posthash=$ posthash";
}
}
else
{
$attachmentoption = '';
}
}
else
{
$attachmentoption = '';
}

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

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

dieselpowered
10-03-2006, 07:16 PM
Ok...I think I have it...did not know there were two other templates that needed to be edited...WHOOPS :)

dieselpowered
10-03-2006, 07:29 PM
Alright, the form is displaying correctly now, however, when it posts the thread, it is not displaying all the answers that were filled in on the form??

dieselpowered
10-03-2006, 07:50 PM
Grrr it is hard to be a moron all the time, however, it seems in this case I have been.

All working, no problems!!!

It is amazing to see what happens when you sit down and read things over and concentrate!

dieselpowered
10-03-2006, 09:34 PM
I did think of something.

Is there a way to force members to fill out the form to create a thread?

For example, the member enters the forum and clicks "New Thread" At that point, the form is pulled up and is filled out. The member submit it and it starts the thread. Others can then reply to it.

I have 2 areas where I want all the first post to be uniform.

Thanks!

d3fuse
10-03-2006, 10:51 PM
I am trying to add more fields to the form, however, it appears to not show up. Therefore, I feel that I am missing something. I want to add another text box. I created the variables or whatever you may name it:

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'normalanswer1' => TYPE_STR,
'normalanswer2' => 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,
'checkboxanswer1_1' => TYPE_STR,
'checkboxanswer1_2' => TYPE_STR,
'checkboxanswer1_3' => TYPE_STR,
'longanswer1' => TYPE_STR
));

// Part 2
$user_name = $bbuserinfo[username];
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$normalanswer2 = $vbulletin->GPC['normalanswer2'];
$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'];
$checkboxanswer1_1 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_2 = $vbulletin->GPC['checkboxanswer1_2'];
$checkboxanswer1_3 = $vbulletin->GPC['checkboxanswer1_3'];
$longanswer1 = $vbulletin->GPC['longanswer1'];

I then added the normalquestion2 under normalquestion1, but it will not show up.

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Why is the sky blue?";

$normalquestion2 = "Why is the grass green?";

What am I doing wrong? I could not locate any templates to edit and add this information. Again, I feel that I am missing something here.

Shazz
10-03-2006, 11:01 PM
If you wanted to added a option it would take alot of tweaks :(

dieselpowered
10-03-2006, 11:45 PM
It is very easy...do not forget to edit the two new template :)

d3fuse
10-04-2006, 04:53 AM
What two new templates?

dieselpowered
10-04-2006, 02:05 PM
What two new templates?
form and formanswers :)

R.Caldwell
10-04-2006, 06:18 PM
I'm still hoping someone can help with the drop down menu for which forum to post to.

I can offer pay for ANYONE who can help me. Support for this is pretty much no-existent.

dieselpowered
10-04-2006, 09:04 PM
I'm still hoping someone can help with the drop down menu for which forum to post to.

I can offer pay for ANYONE who can help me. Support for this is pretty much no-existent.
I wish I could help you...I am still trying to see if there is a way to link the new thread button in a specific forum to the form...thinking it may not be possible. I am trying to force members who are posting in a specific forum to have to use the form for the start of the thread.

d3fuse
10-04-2006, 10:22 PM
That would have to deal with an if statement that checks the forumdisplay number, I would assume. I'll try to locate something and see if it works as I am looking for the same thing. Also, thanks for the template names. Just what I needed!

dieselpowered
10-04-2006, 10:26 PM
That would have to deal with an if statement that checks the forumdisplay number, I would assume. I'll try to locate something and see if it works as I am looking for the same thing. Also, thanks for the template names. Just what I needed!
Ya if you find something please let me know.

Glad I could help with the template names :)

d3fuse
10-04-2006, 10:43 PM
Try this:


<if condition="$forum[forumid]=='x'">
new thread button for form application code
</else>
normal new thread button
</if>



Replace x with the forum ID. I have not tested it yet, but will do so once I finish an event my guild is doing.

dieselpowered
10-04-2006, 11:13 PM
Try this:


<if condition="$forum[forumid]=='x'">
new thread button for form application code
</else>
normal new thread button
</if>



Replace x with the forum ID. I have not tested it yet, but will do so once I finish an event my guild is doing.
Hmmm what code are we wrapping that around?

d3fuse
10-04-2006, 11:27 PM
Well, that script did not work for me, but the following did work below. Basically, the colored text is for the form application link and the black text is for the normal new thread button. Change XX to the forum where the form is in. I cannot remember the ELSE tag which I believe is simple. I'm too tired right now.

Find <!-- controls above thread list --> in FORUMDISPLAY.


<if condition="$foruminfo[forumid] == XX">
<!-- controls above thread list -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:3px">
<tr valign="bottom">
<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?do=formname" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if></td>
<if condition="$pagenav"><td align="$stylevar[right]">$pagenav</td></if>
</tr>
</table>
<!-- / controls above thread list -->
</if>

<if condition="$foruminfo[forumid] <> XX">
<!-- controls above thread list -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:3px">
<tr valign="bottom">
<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if></td>
<if condition="$pagenav"><td align="$stylevar[right]">$pagenav</td></if>
</tr>
</table>
<!-- / controls above thread list -->
</if>

dieselpowered
10-05-2006, 01:04 AM
Well I am not sure...I am not very good with the if then else stuff.

Without the else, does it make it so all NEW THREAD buttons link to the form?

d3fuse
10-05-2006, 01:54 AM
What I have done was use two IF statements. The first IF statement checks to see if the forum is meant for the form. If it is, it displays the newthread button to the form page. The second IF statement checks to see if the forum is NOT meant for the form. If it is not, it displays the regular new thread button.

Shazz
10-05-2006, 01:57 AM
What I have done was use two IF statements. The first IF statement checks to see if the forum is meant for the form. If it is, it displays the newthread button to the form page. The second IF statement checks to see if the forum is NOT meant for the form. If it is not, it displays the regular new thread button.
2 plugins for this?

dieselpowered
10-05-2006, 02:46 AM
What I have done was use two IF statements. The first IF statement checks to see if the forum is meant for the form. If it is, it displays the newthread button to the form page. The second IF statement checks to see if the forum is NOT meant for the form. If it is not, it displays the regular new thread button.
Ahhh I see....two if statements instead of one if and one else :)

dieselpowered
10-05-2006, 02:47 AM
2 plugins for this?
No we were discussing a conditional.

novalogix
10-05-2006, 08:19 AM
Dear all,

i am getting this error with my mod and i can't figure out what is causing it.

Parse error: syntax error, unexpected T_STRING in /home/film/public_html/forum/newthread.php(70) : eval()'d code on line 689

it does this when i go to form and also when i go to my custom form.

novalogix
10-05-2006, 09:07 AM
Dear all,

i am getting this error with my mod and i can't figure out what is causing it.

Parse error: syntax error, unexpected T_STRING in /home/film/public_html/forum/newthread.php(70) : eval()'d code on line 689

it does this when i go to form and also when i go to my custom form.

Pls ignore the previous post, i figured it was a typo i made in the template links.

I have a second problem now, when i fill up the form and hit submit, the post does not get added to the forum. Anyone knows what is causing this?

dieselpowered
10-05-2006, 02:31 PM
Pls ignore the previous post, i figured it was a typo i made in the template links.

I have a second problem now, when i fill up the form and hit submit, the post does not get added to the forum. Anyone knows what is causing this?
Did you go through the plug-in and make the necessary changes to include what forum you want it to post in?

R.Caldwell
10-05-2006, 07:06 PM
I can offer up $50-75 USD for anyone that can help me get the drop down forum list to work.

novalogix
10-06-2006, 03:23 AM
Did you go through the plug-in and make the necessary changes to include what forum you want it to post in?

You mean the part where you give the forum ID? Yes, i did. it just brings me to the forum when i hit submit, but the post did not show.

Lpspider
10-15-2006, 09:09 PM
I'd like to set thus up so whenever users post a reply in X forum, it will show the forum... can't seem to get it to work.

ctrl-alt-del
10-23-2006, 03:05 PM
I can't seem to get more than 3 questions to work:

$question4 = "Question 4?";
$explain4 = "Please enter your URL here.";

$question5 = "Question 5?";
$explain5 = "Please enter your URL here.";

$question6 = "Question 6?";
$explain6 = "Please enter your URL here.";

I have defined them in part 1/2
'answer4' => TYPE_STR,
'answer5' => TYPE_STR,
'answer6' => TYPE_STR,

$answer4 = $vbulletin->GPC['answer4'];
$answer5 = $vbulletin->GPC['answer5'];
$answer6 = $vbulletin->GPC['answer6'];

and also modified the form and form answers:

<tr>
<td class="alt2" valign="middle">
<b>$question4</b>:<br />
$explain4</td>
<td class="alt2" valign="middle" colspan="2">
<input type="text" size="30" value="$answer4" name="answer4" /></td>
</tr>
<tr>
<td class="alt2" valign="middle">
<b>$question5</b>:<br />
$explain5</td>
<td class="alt2" valign="middle" colspan="2">
<input type="text" size="30" value="$answer5" name="answer5" /></td>
</tr>
<tr>
<td class="alt2" valign="middle">
<b>$question6</b>:<br />
$explain6</td>
<td class="alt2" valign="middle" colspan="2">
<input type="text" size="30" value="$answer6" name="answer6" /></td>
</tr>

$question4
$answer4

$question5
$answer5

$question6
$answer6

Am I missing something??

ctrl-alt-del
10-24-2006, 01:28 PM
Okay, I figured out the problem above. However, another issue. Can someone assist me in figuring out how to place the formreplythreadid as a variable that can be called based on a value of a drop down box??


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

ctrl-alt-del
10-24-2006, 02:24 PM
Can someone explain this statement?

if condition="$dropdownchoice2d == $dropdownanswer2">selected="selected"</if>

In the context of:
<option value="$dropdownchoice2d" <if condition="$dropdownchoice2d == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2d</option>

Abe1
10-24-2006, 10:12 PM
Can someone explain this statement?

if condition="$dropdownchoice2d == $dropdownanswer2">selected="selected"</if>

In the context of:
<option value="$dropdownchoice2d" <if condition="$dropdownchoice2d == $dropdownanswer2">selected="selected"</if>>$dropdownchoice2d</option>
This 'if' statement is there so the preview can work good. If it's selected when you click 'preview', it will also be selected.

SeQual
10-25-2006, 03:07 PM
//USERNAME TO PM TO (separate multiple usernames with a ';')
$formpmname = "SeQual";


Instead of putting
$formpmname = "user1;user2;user3";

I wanne put a variable in there
$formpmname = "$pmmembers";

But the people in the variable don't get a pm, only works if I put the usernames in manually.

The variable is correct tho, when I show variable in the form itself (form from newthread_start) it shows the usernames.

Members this will get pm'd to: SeQual;user1;user2

(SeQual;user1;user2 is in variable $pmmembers)

any idea's? :)

pirotess
10-26-2006, 03:00 PM
Abe I could really use a hand here, Im going nuts trying to figure this out.

Im using this mod to post a form to my forums and it works great with no issues. However I recently decided it would be nice if the form created a second thread/post in a different forum. I made the following modifications to the original plugin. Essentially I just duplicated all the variables and code used in the default plugin responsible for creating the post which I know works and modified a few variables. With all my modifications the original code continues to work but the duplicated code refuses to post in the second forum. I cant understand why since its exactly the same code. Any thoughts?

// Name of the main template
$maintemplate = "wow_appform";
// Name of the answer template
$answertemplate = "wow_apppostcandidate";
// Name of template to be posted to journal forum
$journaltemplate = "wow_apppostjournal";

//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 = "141";
$journalforumid = "140";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "$bbuserinfo[username] Recruitment Application";
$journaltitle = "$bbuserinfo[username] Journal";

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


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';
$newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

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);

$foruminfo = verify_id('forum', $journalforumid, 0, 1);
$forumperms = fetch_permissions($foruminfo[forumid]);
$newpost['username'] =& $vbulletin->userinfo['username'];
$newpost['message'] =& $journalsend;
$newpost['title'] =& $journaltitle;
$newpost['parseurl'] = '1';
$newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

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);

}

pirotess
10-26-2006, 03:14 PM
Well wouldnt you know it. After fighting with things for 4 hours, I figured out the problem about 5 minutes after I posted here for help. I had my minimum time between posts option set to 15 which was bouncing the second post. Disabling that option let both posts go through.

ctrl-alt-del
10-26-2006, 03:19 PM
My question happens to be basic PHP/HTML, but since I'm not a developer, I can't figure out the issue.

I'm trying to associate values (numeric) based on a selection of a dropdown. The numeric variable is associated to a thread ID wherease the dropdown selection is a recognizable name.

Here's the default code:
<select name="dropdownanswer1">
<option value="$dropdownchoice1a" <if condition="$dropdownchoice1a == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1a</option>
</select>

I need to change it to something like:
<option value="$dropdownthreadID" <if condition="$dropdownchoice1a == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1a</option>

Where:
$dropdownthreadID = 100
$dropdownchoice1a = Monday

These variables are called within a newthread_start plugin.
//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid = "$dropdownanswer1";

Here's the problem: I can't seem to figure out how to call the named variable (Monday) when the form is submitted. Instead, I get the numerical value. Perhaps it's just a simple IF statement I need to add that writes Monday into another variable. However, I can't seem to figure it out.

Any help would be appreciated!

hal05
10-28-2006, 02:26 AM
Great mod! I change some variable and put my own html over it and it works wonders!

ctrl-alt-del
10-30-2006, 03:24 PM
Is it possible to insert an IF statement in the Answers form? If so, please tell me how.

hal05
10-30-2006, 10:35 PM
Anyone know how I can pass some of the variables into the thread title?

TenPercenter
10-31-2006, 01:46 AM
<a href="http://www.chiptalk.net/forum/newthread.php?do=poker_article_submit" target="_blank">Installed</a>! Great hack.

Can I prepopulate any elements? I'd particularly like to pre-populate the vb text area input box. I want to put a template in there, so taht users format article submissions correctly.

gonkowonko
11-01-2006, 09:54 AM
i managed to set one form up which works wonderfully,

The problem has arrisen when i try to create another form.

Ive copied the plugin and altered the form name and also created 2 new templates and linked them to the pluging but when i try and access it i get this error message
Parse error: parse error, unexpected $ in /home/forum/newthread.php(71) : eval()'d code on line 863

where would i look to for this error? Plugin or templates as i tried and i just cant see it :(

Abe1
11-01-2006, 11:55 AM
Look around line 863 in the plug-in.

gonkowonko
11-01-2006, 12:56 PM
Look around line 863 in the plug-in.
only goes upto 401 :confused:

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

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(
'checkboxanswer1_1' => TYPE_STR,
'checkboxanswer1_2' => TYPE_STR,
'dropdownchoice1' => TYPE_STR,
'dropdownchoice2' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'answer4' => TYPE_STR,
'longanswer1' => TYPE_STR
));

// Part 2
$checkboxanswer1_1 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_2 = $vbulletin->GPC['checkboxanswer1_2'];
$dropdownchoice1 = $vbulletin->GPC['dropdownchoice1'];
$dropdownchoice2 = $vbulletin->GPC['dropdownchoice2'];
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$answer4 = $vbulletin->GPC['answer4'];
$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(6,7,2,5,18,15,11,19,13,16,10))) 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_christmas";
// Name of the answer template
$answertemplate = "formanswers_christmas";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "myemailaddress@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 submitting your SSS Christmas Party Booking Form, Please make sure you pay for it otherwise this form will be void"; //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)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "SSS Christmas Party 2006 - Booking 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)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formpurpose = "Please fill out this booking form as fully and as accurate as possible as errors could mean you might lose your place";

////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 1 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$checkboxquestion1 = "Please tick which parties you would like to attend";

$checkboxchoice1_1 = "St Austell - 2nd Decemeber";
$checkboxchoice1_2 = "Plymouth - 15th December";


$dropdownquestion1 = "How many tickets would you like?";

// The following choices must NOT have quotation marks
$dropdownchoice1a = "1";
$dropdownchoice1b = "2";
$dropdownchoice1c = "3";
$dropdownchoice1d = "4";
$dropdownchoice1e = "5";

$dropdownquestion2 = "Method of Payment";

// The following choices must NOT have quotation marks
$dropdownchoice2a = "Cash";
$dropdownchoice2b = "Cheque";
$dropdownchoice2c = "Paypal";


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

//QUESTION 1 (do not use quotation marks or you will get a parse error)
$question1 = "Real name";
$explain1 = "Forename and Surname";

//QUESTION 2 (do not use quotation marks or you will get a parse error)
$question2 = "Email Address";
$explain2 = "";

//QUESTION 3 (do not use quotation marks or you will get a parse error)
$question3 = "Home telephone number";
$explain3 = "";

//QUESTION 4 (do not use quotation marks or you will get a parse error)
$question4 = "Mobile number";
$explain4 = "";


////////////////////////////////////////////////////////////////////////////////////////////////////
//LONG TEXT AREA INPUT: QUESTION 1 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$longquestion1 = "Address inc Postcode";
$longexplain1 = "Please enter your address inc postcode";

////////////////////////////////////////////////////////////////////////////////////////////////
////// 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 ($answer1 == '' OR $dropdownchoice1 == '' OR $dropdownchoice2 == '' OR $answer2 == '' OR $longanswer1 == '')
{
$errormessage = "$bbuserinfo[username], you must complete the required 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 ($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';
$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";
$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();
}

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

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

the form gets emailed on submission, ive removed the email address

Can u see any errors here?

MrD
11-02-2006, 08:22 PM
Hi,
has everyone run this plugin in Combination with Mystics Präfix Hack?

mr clean
11-04-2006, 10:41 PM
I've installed this form on a few sites and it has worked perfectly. But I am trying to use a variable for the $formforumid on one.....

$formforumid = "$dropdownanswer1";

I am only able to see the attachment option if I select preview. So basically, the attachment option is only visible after the variable has been called(selecting preview). My coding skills are horrible, does anyone have any idea what I can do to make attachments work when the form is initially pulled up?

bahattab
11-05-2006, 01:08 PM
hi

could any one help me :surprised:

i am trying to use this hack but i did not know how to use it. :confused:

is there any Tutorial for changing this hack to what i want ? :surprised:

how to the form name ?
how to change the fields ?
how to change the variables in both the form and the form answer ?

thenks
regards
Emad Bahattab :)

dutchbb
11-11-2006, 10:33 PM
Is it possible to place the attachment somewhere in the post instead of on the bottom? A variable in formanswers for attachments would be nice :)

Great hack

Abe1
11-12-2006, 04:26 AM
Is it possible to place the attachment somewhere in the post instead of on the bottom? A variable in formanswers for attachments would be nice :)

Great hack
I can't make it change the way vb puts the attachments.

civil78
11-12-2006, 09:00 AM
I am trying to make this.

I choose a forum that the registered users can't view. I have only make this selections in the forum permissions "Can View Forum = No" and the others yes. (and of course the can post and can upload attachment permissions is set to yes).

The problem is I run the form like a simple registered user, the attach table and button appears, but when I click in the button in the pop up window it says with a message that you can't post attachment.

If I change this permission "Can View Forum = Yes" everything works well.

The problem is that I don’t want the simple registered users see the answers and of course to downloads the attachments.

How can I fix that?

civil78
11-12-2006, 10:38 AM
I solve it! For anyone that wants to know.

1) Ftp Server
Create a copy of newattachment.php --> newattachmentmine.php

2) VBulletin Templates
Create a new clone of newattachment, newpost_attachment, newpost_attachmentbit, newpost_attachment, newattachment_errormessage, newattachment_keybit, template, for example newattachmentmine, newpost_attachmentmine, newpost_attachmentbitmine, newpost_attachmentmine, newattachment_errormessagemine, newattachment_keybitmine.

Into this templates replace the value newattachment.php with the new newattachmentmine.php file.

3) Form Hack PHP

Replace the values newattachment.php, newpost_attachment, newpost_attachmentbit to the new one newattachmentmine.php,newpost_attachment_mine,newp ost_attachmentbit_mine.

4) In this file newattachmentmine.php replace all this templates newattachment, newpost_attachment, newpost_attachmentbit, newpost_attachment, newattachment_errormessage, newattachment_keybit, with the new.

Also find this code (normally in line 79)

// No permissions to post attachments in this forum or no permission to view threads in this forum.
if (empty($vbulletin->userinfo['attachmentextensions']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']))
{
print_no_permission();
}

Remove this from the if.

OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])

Like this.

// No permissions to post attachments in this forum or no permission to view threads in this forum.
if (empty($vbulletin->userinfo['attachmentextensions']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']))
{
print_no_permission();
}

After that if you change the permission setting in a forum "Can View Forum = No" and the others yes. Users can post the form and can attach files normally, but they can’t see the answer post.

I think maybe it’s useful for someone this trick.

P.S. Be careful, because if you don’t do that correctly may you corrupt the form or the attach option of your site.

timetunnel
11-15-2006, 08:39 PM
Hello.

Where is new form field data stored if the database is unaltered?

Thanks in advance.

Abe1
11-15-2006, 11:43 PM
Hello.

Where is new form field data stored if the database is unaltered?


Thanks in advance.
Plug-in and template.

timetunnel
11-16-2006, 03:50 AM
Thanks for your reply.

Let me ask it another way...

what I mean is, when the data from the new form fields is submitted, where does that data go if the database is not revised to store that data -- to a flat file?

Thanks again, in advance.

Abe1
11-16-2006, 04:15 AM
Thanks for your reply.

Let me ask it another way...

what I mean is, when the data from the new form fields is submitted, where does that data go if the database is not revised to store that data -- to a flat file?

Thanks again, in advance.
Of course it goes into the database.

timetunnel
11-16-2006, 05:02 AM
Thanks again for your reply.

I guess I somehow overlooked finding 'how' the fields were added to the database when I looked at the xml file. :confused:

I'm still learning this stuff...

Thanks.

mkinnov8
11-16-2006, 01:08 PM
thanks to ChrisBaktis for having the problems he was having, and to those who helped solve it, been having exactly the same issue, and its now fixed from reading this thread. Thanks to the original author, but you have to expect questions with every release.

Mirage Guardian
11-16-2006, 02:54 PM
after installing, I got a database error when I call "newthread.php?do=form"

Database error in vBulletin 3.6.1:

Invalid SQL:
SELECT * FROM forumpermission
WHERE ( forumid IN() AND usergroupid IN (6)) AND
(maxthread=0 AND perhour=0);

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND usergroupid IN (6)) AND
(maxthread=0 AND perhour=0)' at line 2
Error Number : 1064

The normal "newthread.php" syntax is:
http://my/forum/path/newthread.php?do=newthread&f=2
and when i call "newthread.php?do=form&f=2", the form start, but never submit and give the same database error.


What shall i do?

Roms
11-16-2006, 10:06 PM
Thanks Abe, you're awesome. :)

Glynn58
11-22-2006, 09:37 AM
I need a very simple form to email answers to the questions.

Can I make this auto complete the users username and email address and include this in the email?

Like the standard Vbulletin contact us form does.

Many thanks

steven s
11-23-2006, 04:16 PM
Great mod. But then again, so was the 3.5 version.

I'm having two problems.
I am unable to send to multiple email addresses.
The two addresses are separated with a ;. Only one is sent.
Version 3.5 worked with multiple addresses using a ,.
Both versions take a long time to send copy of the form to the email addresses.

steven s
11-23-2006, 08:58 PM
I need a very simple form to email answers to the questions.

Can I make this auto complete the users username and email address and include this in the email?

Like the standard Vbulletin contact us form does.

Many thanksYou can include
Username: $bbuserinfo[username]
Email address: $bbuserinfo[email]
in your answer template.

Shazz
11-23-2006, 09:09 PM
Working perfect on 3.6 and can't find bugs at the moment...(with my custom modifications done to it :D)

Abe1
11-23-2006, 09:31 PM
Great mod. But then again, so was the 3.5 version.

I'm having two problems.
I am unable to send to multiple email addresses.
The two addresses are separated with a ;. Only one is sent.
Version 3.5 worked with multiple addresses using a ,.
Both versions take a long time to send copy of the form to the email addresses.
Just looked at the code it looks like it should work. I would have to look in your acp to find out why it isn't working.

steven s
11-23-2006, 10:51 PM
Just looked at the code it looks like it should work. I would have to look in your acp to find out why it isn't working.I took a different approach after setting up an account for you to use.
Now I realize I am getting the two emails sent to $formemailaddress. What is not happening is, I'm not getting a copy of the form sent to the user's email address. Sorry if that's confusing. When I submit the form, I should actually get 3 copies. 2 being sent to the $formemailaddress and 1 sent to the email address used on the form being submitted. In this case, me.

Edit: It can take 10-15 minutes to receive the form by email.

Sarcoth
11-24-2006, 02:31 PM
Great Hack. This is definitely my favorite one. It has helped me learn a lot about coding within vBulletin.

If anyone ever needs help creating forms, feel free to check out some of my examples. You are also welcomed to request additional examples. I'll be adding more as time permits.

My Form Examples (http://vanguard.sacredhaven.org/index.php?page=Test_Form_Intro)

Thanks,
Sarcoth

civil78
11-25-2006, 04:12 PM
I need a very simple form to email answers to the questions.

Can I make this auto complete the users username and email address and include this in the email?

Like the standard Vbulletin contact us form does.

Many thanks

To use the function of auto complete user (like the pm field) you have to create a textarea box with this code in the form template.


<textarea id="namerecips_txt" value="$UsersValue" name="UsersValue" rows="2" cols="30" tabindex="1">$UsersValue</textarea></div>
<div class="vbmenu_popup" id="namerecips_menu" style="display:none; z-index:50"></div>
<script type="text/javascript" src="clientscript/vbulletin_ajax_namesugg.js"></script>
<script type="text/javascript">
<!--
vbmenu_register('namerecips', true);
recip_sugg = new vB_AJAX_NameSuggest('recip_sugg', 'namerecips_txt', 'namerecips');
recip_sugg.allow_multiple = true;
//-->
</script>


If you want to add 2 or more boxes you have to change in the script the namerecips*, recip* parameters to something else like namerecips1, recip1.

beansbaxter
11-26-2006, 03:33 AM
running 3.6.3....it works good. you do have to have some working knowledge of code/form/php to make the forms. but overall this is a great add-on!!

no problems - a couple bugs but i think they are more the limitation of vbulletin - was able to work through everything and accomplish what i needed just fine.

thanks for this!!

johnstires
11-27-2006, 02:03 AM
For some reason Unregistered users using IE cannot access my form. They can through Firefox, but not IE.

DarkDraco07
11-28-2006, 02:12 AM
how can i make it possible to use $post[fieldx] variable as my $posttitle? i would really like this to work. thx

Greek Wizard
11-28-2006, 11:42 AM
Great Hack. This is definitely my favorite one. It has helped me learn a lot about coding within vBulletin.

If anyone ever needs help creating forms, feel free to check out some of my examples. You are also welcomed to request additional examples. I'll be adding more as time permits.

My Form Examples (http://vanguard.sacredhaven.org/index.php?page=Test_Form_Intro)

Thanks,
Sarcoth

That's pretty cool.

When I get a chance, I will have to look that over and check out your work :)

DarkDraco07
11-30-2006, 02:37 AM
how can i make it possible to use $post[fieldx] variable as my $posttitle? i would really like this to work. thx

anyone? =/ i really need this

ICY ICE
11-30-2006, 09:38 AM
Very cool mod...thanks!

DarkDraco07
12-01-2006, 10:44 PM
is it possible to redirect this page to the "log in" page if the person isnt logged in?

Shazz
12-01-2006, 11:38 PM
is it possible to redirect this page to the "log in" page if the person isnt logged in?

ID use the <if condition code

DarkDraco07
12-02-2006, 06:26 AM
ID use the <if condition code

if u dont mind could u please guide me in doing that.

LT Mote
12-05-2006, 10:38 PM
Where is this "hook" located? I don't see anything with that name to follow the intructions

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

Dankness
12-05-2006, 11:04 PM
Where is this "hook" located? I don't see anything with that name to follow the intructions

Go in your plugin manager and look for FormHack its one of those.

TheFocusElf
12-06-2006, 01:42 AM
Another EXCELLENT mod. Thank you.

The_Rayman
12-12-2006, 11:10 AM
Great man!

Works like a charm here!!!

Is there any way i can change the email name to the user who fills in the form?
Now it's webmaster, as the form was created by the webmaster.
Also, when reply-ing into a thread, webmaster is the one who posts... can that be changed too?

Thanks!

AzzidReign
12-12-2006, 03:09 PM
Works great! Thanks.

optrex
12-13-2006, 01:17 PM
Nice hack Abe1,

I have a couple of questions before I install.

1) Is there a need/requirement for flood control
2) Is there a need/requirement for image verification

Just wondering if these would be measures to put in to prevent "spamming" ?

blacklancer
12-14-2006, 09:57 PM
I'm having problems with this hack...

I have the need for 2 forms. I made the easier one of the 2 first and tested it and it works fine. When I do the 2nd one, it gives me the following error when I try to submit the form.

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 763

any advice on what to do??

blacklancer
12-15-2006, 05:31 PM
anyone? http://www.sclc.net/forum/images/smilies/lol.gif

laittnet
12-18-2006, 02:31 AM
I wanna write the form variables to the database, but it turn in to trouble if one field contains quote mark, for example " or '

//$db->query_write("
// INSERT IGNORE INTO agent_register(userid, fullname, email, phone_mobile, phone_fixed, address, city, country, agent_type, ic_owner, ic_pc, sell_already, sell_cards, cards_month, pay_direct, pay_atm, pay_transfer, pay_post, pay_mb, pay_other, otherinfo, date_submit)
// VALUES
// ({$vbulletin->userinfo['userid']}, {$vbulletin->GPC['answer1']}, {$vbulletin->GPC['answer2']}, {$vbulletin->GPC['answer3']}, {$vbulletin->GPC['answer4']}, {$vbulletin->GPC['answer5']}, {$vbulletin->GPC['answer6']}, {$vbulletin->GPC['answer7']}, {$vbulletin->GPC['radioanswer3']}, {$vbulletin->GPC['radioanswer4']}, {$vbulletin->GPC['radioanswer4other']}, {$vbulletin->GPC['radioanswer5']}, {$vbulletin->GPC['radioanswer5other']}, {$vbulletin->GPC['dropdownanswer1']}, {$vbulletin->GPC['checkboxanswer1_1']}, {$vbulletin->GPC['checkboxanswer1_2']}, {$vbulletin->GPC['checkboxanswer1_3']}, {$vbulletin->GPC['checkboxanswer1_4']}, {$vbulletin->GPC['checkboxanswer1_5']}, {$vbulletin->GPC['checkboxanswer1_6']}, $vbtextanswer, ". TIMENOW . ")
//");

How can I handle this problem?

DarkDraco07
12-18-2006, 06:01 PM
can anyone help with my problem? i want only members that are logged in to be able to use the form =/

civil78
12-18-2006, 08:32 PM
can anyone help with my problem? i want only members that are logged in to be able to use the form =/

Search in form hack php code, this phrase

//USERGROUPS ALLOWED

It's in the start of php.

After that find this if check

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

Remove the // and in the array(2,5,6,7) set the id numbers of the user groups that you want to allow.

DarkDraco07
12-22-2006, 02:55 PM
wow... how did i not see that...
thx

gullystation
12-22-2006, 05:58 PM
where is this : /newthread.php?do=form ? Where do i put it, can anyone help me?

civil78
12-22-2006, 06:49 PM
where is this : /newthread.php?do=form ? Where do i put it, can anyone help me?

Go to Plugins & Products --> Plugin Manager and edit under the the Product : Form Hack the Form Hack plugin (you can add more forms if you go down in the [Add New Plugin], see the example of Form Hack and clone it) and in the inside the php code find this

$formname = "form";

The varieble formname is the name of your form. To call your form from your site just write "http://www.yoursitename.com/newthread.php?do= + $formname". like http://www.yoursitename.com/newthread.php?do=form

As you see you can add multiple forms just change the name in the $formname varieble in every new plugin.

Also if you want to make new forms you have to change or add a new template in Styles & Templates, the templates with names in this variebles.

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

$maintemplate is the varieble that contains the name of the template as it show if you call the newthread.php?do=form url, and the $answertemplate contains the name of the template of the post.

I hope that you are undestand that.

elricstorm
12-26-2006, 07:39 PM
I'm starting to become very proficient with this plugin and I've created 5 separate "advanced" forms, but now I'd like to take it to a new level.

I want to move the form from posting a message in a thread to posting a calendar event. How difficult would this be?

For instance, the normal forms point to newthread_start and I'm guessing I would change this to calendar_start. So my questions are thus:

1. What form elements would I use to handle date parameters that are already in the existing calendars?
2. Would the form elements have to be separate to account for single day, multi-day, and recurring events?
3. If you look at a "recurring calendar event" I would want to start the form so that it looks exactly like this, with the exception of the editor box which the rest of the form would replace so that I could choose the type of questions/answers I would use here.

I know this might sound difficult, but I feel that if I'm pointed in the right direction, I'm positive I could figure it out. I'm good at hacking/editing existing code due to having a photographic memory.

Thanks in advance.

John Diver
12-28-2006, 09:16 AM
Can this be included in a custom page? I would like to include multiple forms in one page - www.DeuceAce.com/advertise.php

Thanks,
John

EDIT: I have it installed on a separate page but when it gets submitted I get the error:

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

Mr Pink
12-28-2006, 11:07 AM
This is what I'm searching for my GDR! Thanks, Abe1. Installed, and nominated as MOTM.

cooldude714
12-28-2006, 01:44 PM
I imported the product... what now?

So complicated!

Shazz
12-28-2006, 04:01 PM
I imported the product... what now?

So complicated!

Did you read the installation file

soul__stealer
12-29-2006, 03:17 PM
Just like to say thanks and this is a great addon for vBulletin.

For people starting out with modifying their vBulletin configs, it does seem a little complicated at first. After a few attempts, re-reads of this thread and a bit of trial and error, I've come up with exactly what I wanted and it works like a charm.

Clicked Installed

Mr Pink
12-29-2006, 03:21 PM
I haven't understand where can I customize it! :(

ccmoon
12-29-2006, 04:32 PM
this is great Add-on. But I would like to use it as a music module for song writer. Please look at this link first
http://www.trinhnu.net/h/hoason/?action=Music&case=view&musicId=1533

Is there a way to upload mp3 file, and song sheet JPG or GIF file?
After uploading completed, it will display like the link above.

can this be done??
Or anyone know whether we have a music module for vB or not??
thanks

blind-eddie
12-30-2006, 12:36 AM
To edit content of form,after uploading, goto
admincp/Plugins & Products/Plug in Manager/Form Hack, hit edit...follow instructions closely



I do have one question on editing, look at Screen Shot and please tell me how to get rid of the 5 dots....Please & Thank You,

http://img138.imageshack.us/img138/2410/formcf9.th.gif (http://img138.imageshack.us/my.php?image=formcf9.gif)

John Diver
12-30-2006, 08:14 AM
Can this be included in a custom page? I would like to include multiple forms in one page - www.DeuceAce.com/advertise.php

Thanks,
John

EDIT: I have it installed on a separate page but when it gets submitted I get the error:

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

Anyone know?

Thanks :)

blind-eddie
12-30-2006, 12:41 PM
Did you go to admincp/Plugins & Products/Plugin Manager and edit the second
form hack?

//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 = "Whatever id you want";

Mr Pink
12-30-2006, 04:13 PM
To edit content of form,after uploading, goto
admincp/Plugins & Products/Plug in Manager/Form Hack, hit edit...follow instructions closely


Thanks.

civil78
12-30-2006, 05:08 PM
To edit content of form,after uploading, goto
admincp/Plugins & Products/Plug in Manager/Form Hack, hit edit...follow instructions closely

I do have one question on editing, look at Screen Shot and please tell me how to get rid of the 5 dots....Please & Thank You,


First of all you use this for the radio button.

<td><input type="radio" name="radioanswer1" value="" checked="checked" /> </td>
<td><input type="radio" name="radioanswer1" value="" checked="checked" /> </td>

This is wrong because you don't parse any value with value="" Second you don?t put a string between /> </td> this is required to know the user what it means the check and to parse a value on $RadioAnswer if this opton is checked.
Third you can't set as checked both radio buttons with this checked="checked"

The correct format is this

<td><input type="radio" name="RadioAnswer1" value="$RadioChoiceA" <if condition="$RadioChoiceA == $RadioAnswer">checked="checked"</if> /> $RadioChoiceA
<td><input type="radio" name="RadioAnswer1" value="$RadioChoiceB" <if condition="$RadioChoiceB == $RadioAnswer">checked="checked"</if> /> $RadioChoiceB

RadioAnswer1 -> The name i must be the same in every group of radio buttons.

$RadioChoiceA,$RadioChoiceB -> These variables must set it in the PHP code of your form with this to show it on the user.

$RadioChoiceA = "Message of option 1";
$RadioChoiceB = "Message of option 2";

$RadioAnswer -> In PHP again this variable keeps the choice of the user (in this string keeps the values of options $RadioChoiceA or $RadioChoiceB)

'Part 1'
RadioAnswer' => TYPE_STR,
'Part 2
$RadioAnswer = $vbulletin->GPC['RadioAnswer'];


Final if you see we use this if condition

<if condition="$RadioChoiceA == $RadioAnswer">checked="checked"</if>

This is because if you make Reset or Preview the user wants to keep the choice.

I hope that it helps.

blind-eddie
12-30-2006, 08:31 PM
Thank You Very Much...

Spinball
12-30-2006, 09:50 PM
Hello,
trying after a long while to reinstate this functionality.
I'm using it in conjunction with your 'edit new thread button' hack to open a classified adverts form for several specific (classifieds) forums.
So I need to have an &f=n in the link to the form.
E.g. http://www.avforums.com/forums/newthread.php?do=classified&f=115

And you have a comment in your plugin which says
//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.
So I did this:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'ad_type' => TYPE_STR,
'ad_title' => TYPE_STR,
'ad_location' => TYPE_STR,
'ad_agree' => TYPE_STR,
'f' => TYPE_STR
));

// Part 2
$ad_type = $vbulletin->GPC['ad_type'];
$ad_title = $vbulletin->GPC['ad_title'];
$ad_location = $vbulletin->GPC['ad_location'];
$ad_agree = $vbulletin->GPC['ad_agree'];
$f = $vbulletin->GPC['f'];
and I put this in, 'just in case'
//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.
if (!$f) {$f=62;} // default forum is av kit for sale
$formforumid = $f;

But the value of f isn't being assigned to the parameter variable. It's always 62
What additional stuff do I need, please?
And do I need to create a hidden input in the form value of $f to pass it on?

zeropaid
01-03-2007, 03:26 AM
I am looking for a developer to help me with creating a few simple forms that I don't have time to deal with.

If you are interested, please PM me.

Thanks

Luky
01-03-2007, 02:14 PM
Awesome Idea!

hal05
01-05-2007, 10:17 PM
Looking for the same thing, everything else looks good.:surprised:

how can i make it possible to use $post[fieldx] variable as my $posttitle? i would really like this to work. thx

Spinball
01-06-2007, 09:55 PM
Can anyone help with my request above?
Thanks

civil78
01-13-2007, 02:17 PM
I can make a form that it creates a poll in the message, but I am trying to find the way to make it to vote in an existing poll in a thread. Any idea?

criscokid
01-13-2007, 04:24 PM
Suggestion for future version: The ability for the contents of the form to be posted as an event in the calendar.

Abe1
01-14-2007, 01:42 AM
Suggestion for future version: The ability for the contents of the form to be posted as an event in the calendar.
Nice Idea. Putting on my list.

basilrath
01-14-2007, 06:24 PM
any idea why i cant make question 4 appear on the form ?

and how to add questions etc ive tried to add number 4 but not showing although ive entered in the variables

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

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,
'answer4' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'checkboxanswer1_1' => TYPE_STR,
'checkboxanswer1_2' => TYPE_STR,
'checkboxanswer1_3' => 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'];
$answer4 = $vbulletin->GPC['answer4'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$checkboxanswer1_1 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_2 = $vbulletin->GPC['checkboxanswer1_2'];
$checkboxanswer1_3 = $vbulletin->GPC['checkboxanswer1_3'];
$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 = "76";

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

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

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

//USERNAME TO PM TO (separate multiple usernames with a ';')
$formpmname = "Abe";

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

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

//EMAIL ADDRESS TO EMAIL TO (separate multiple usernames with a ';')
$formemailaddress = "admin@thebigfatsofa.com";

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

//ENABLE ATTACHMENTS - 1 = yes, 0 = no
//attachments can only be used if the form is going to make a new thread or post
$allow_attachments = "0";

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



////////////////////////////////////////////////////////////////////////////////////////////////////
//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 (thread or reply)
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption = "0";

$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 = "TBFS Improvement Survey 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 = "The purpose of this form is to recieve feedback from members in the community, please answer honestly to give us a true picture of what is good / bad or indeed both.";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "How did you find the TBFS community";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Would you recommend a friend to join TBFS";

// 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 of the options below descibes TBFS best";

// 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 there anyway you can think of we could improve the site, if yes elaborate for us.";

// 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 first name?";
$explain1 = "Please enter your first 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 = "Are you a member of another site like TBFS if so help us by giving the URL?";
$explain3 = "Please enter your URL of the other forum / site here.";


//QUESTION 4 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question4 = "Is there anything in particular you DISLIKE about the site?";
$explain4 = "Please give a little detail.";

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

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

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

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

$checkboxquestion1 = "How many times do you log in on average weekly.";

// The following choices must NOT have quotation marks
$checkboxchoice1_1 = "5";
$checkboxchoice1_2 = "20";
$checkboxchoice1_3 = "100+";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 how you could improve the site in any shape or form.";
$longexplain1 = "For example, what makes this forum different from all other forums and how is it worse or better, please be honest as this helps us improve TBFS.";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Anything you would like to add further please feel free.";
$vbtextexplain = "For example things you feel are important to the success of TBFS, your honesty is appreciated as it helps us improve";

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

Spinball
01-14-2007, 06:36 PM
Abe1, any chance you could help me with the above question (https://vborg.vbsupport.ru/showpost.php?p=1147731&postcount=228), please?

Abe1
01-15-2007, 03:16 AM
any idea why i cant make question 4 appear on the form ?

and how to add questions etc ive tried to add number 4 but not showing although ive entered in the variables

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

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,
'answer4' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'checkboxanswer1_1' => TYPE_STR,
'checkboxanswer1_2' => TYPE_STR,
'checkboxanswer1_3' => 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'];
$answer4 = $vbulletin->GPC['answer4'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$checkboxanswer1_1 = $vbulletin->GPC['checkboxanswer1_1'];
$checkboxanswer1_2 = $vbulletin->GPC['checkboxanswer1_2'];
$checkboxanswer1_3 = $vbulletin->GPC['checkboxanswer1_3'];
$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 = "76";

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

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

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

//USERNAME TO PM TO (separate multiple usernames with a ';')
$formpmname = "Abe";

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

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

//EMAIL ADDRESS TO EMAIL TO (separate multiple usernames with a ';')
$formemailaddress = "admin@thebigfatsofa.com";

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

//ENABLE ATTACHMENTS - 1 = yes, 0 = no
//attachments can only be used if the form is going to make a new thread or post
$allow_attachments = "0";

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



////////////////////////////////////////////////////////////////////////////////////////////////////
//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 (thread or reply)
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption = "0";

$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 = "TBFS Improvement Survey 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 = "The purpose of this form is to recieve feedback from members in the community, please answer honestly to give us a true picture of what is good / bad or indeed both.";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "How did you find the TBFS community";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Would you recommend a friend to join TBFS";

// 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 of the options below descibes TBFS best";

// 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 there anyway you can think of we could improve the site, if yes elaborate for us.";

// 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 first name?";
$explain1 = "Please enter your first 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 = "Are you a member of another site like TBFS if so help us by giving the URL?";
$explain3 = "Please enter your URL of the other forum / site here.";


//QUESTION 4 (do not use quotation marks or you will get a parse error, besides the quotes around the whole text)
$question4 = "Is there anything in particular you DISLIKE about the site?";
$explain4 = "Please give a little detail.";

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

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

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

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

$checkboxquestion1 = "How many times do you log in on average weekly.";

// The following choices must NOT have quotation marks
$checkboxchoice1_1 = "5";
$checkboxchoice1_2 = "20";
$checkboxchoice1_3 = "100+";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 how you could improve the site in any shape or form.";
$longexplain1 = "For example, what makes this forum different from all other forums and how is it worse or better, please be honest as this helps us improve TBFS.";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "Anything you would like to add further please feel free.";
$vbtextexplain = "For example things you feel are important to the success of TBFS, your honesty is appreciated as it helps us improve";

////////////////////////////////////////////////////////////////////////////////////////////////
////// END OF CUSTOMIZATION ////////////////////////////////////////////////////////////////////
///// DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!!! ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
Add it to the template also.

Abe1
01-15-2007, 03:18 AM
Abe1, any chance you could help me with the above question (https://vborg.vbsupport.ru/showpost.php?p=1147731&postcount=228), please?
You need to add in the template a 'hidden' field so the f gets moved from the original page to the submit page.

SEYTAN_NL
01-15-2007, 09:10 PM
having problem with caracter encoding ş ı show up as Þ ý
can somone help please ?

joh
01-15-2007, 10:58 PM
ok i just added this to my site.
I can find where to fill out the form http://nsraweb.com/newthread.php?do=form
once it is filled out, it goes to Moderation at http://nsraweb.com/modcp/moderate.php?do=posts

now once i Validate I get this
Fatal error: Existing data passed is not an array
Called set_existing in /home/joh77/nsraweb.com/html/includes/functions_databuild.php on line 164
Called build_forum_counters in /home/joh77/nsraweb.com/html/modcp/moderate.php on line 674
in /includes/class_dm.php on line 235

where did I go wrong?
why is it going to Moderation?

I am not a coder so I have no clue what is going on.

Kinneas
01-17-2007, 11:15 AM
Nice hack, got a quick question though.

I'm currently using the 3.5 version of this and it took me ages to set up all my current forms. Is there an easy way to upgrade to this version without trashing all my current forms and having to start again?

If not I'll just have to stick with the old version :(

Abe1
01-17-2007, 11:46 AM
Compare the 2 version.

PinkDaisy
01-18-2007, 02:21 PM
Okay, I have modified the questions and all to suit my needs for it working as a Community Leader Application, and once it's submitted, it goes to Admin forum for us to vote on and discuss. The only thing I can't get to work is all the questions from the application/form itself, showing up in the thread it starts in the Admin forum. What am I doing wrong ??

Thanks in advance!!

rjmjr69
01-22-2007, 06:44 AM
Can I add this as a link in the toolbar?

basilrath
01-22-2007, 07:23 AM
Yes just link the php as normal

fluentdesigns
01-23-2007, 10:34 PM
Im having trouble understanding how to creat a form? It says

2 - Edit the main hook (plug-in) - the instructions are all inside the hook itself, in the top half. Follow the instructions carefully!

but I have no idea what the heck that means. Plus in the description is says this hack is totally customizable via the admincp?

wintrmte
01-24-2007, 04:55 PM
Great hack, but I'm having one problem.

The posts to a forum are being posted as Moderated. The forum permissions are set to be Non Moderated. How do I fix this?

Thanks!

Spinball
01-24-2007, 07:12 PM
You need to add in the template a 'hidden' field so the f gets moved from the original page to the submit page.I did. The f isn't being picked up the first time the script is run, so that the value of f in the form is null.

GrossKopf
01-28-2007, 04:34 AM
Ok, I'm doing something wrong. I'm a total noob to vbulletin so please explain. I am getting the same results as this person:

https://vborg.vbsupport.ru/showpost.php?p=1075706&postcount=22

Can someone explain in step by step instructions what I need to do to remove the empty fields and get the fields I want to display?

Here's my actual form:

http://flotserver.net/forums/newthread.php?do=flotapp

lazytown
01-28-2007, 10:11 AM
I'm starting to get spam through this, and as another user mentioned, the threads are marked for moderation for some reason.

I was hoping the captcha alternative (asking questions) could be applied to this mod.

-vissa

GrossKopf
01-28-2007, 11:00 AM
I appologize if my question's been answered before, but 17 pages of questions was a lot to look through at 1:30am. I figured if I asked my question, maybe it would be answered before I have time to go through all 17 pages. If this is a common error, maybe a readme included with the hack could be written to address this problem?

Abe1
01-28-2007, 11:46 AM
I did. The f isn't being picked up the first time the script is run, so that the value of f in the form is null.

use 'forumid'. f gets changed to forumid

Abe1
01-28-2007, 11:48 AM
Im having trouble understanding how to creat a form? It says


2 - Edit the main hook (plug-in) - the instructions are all inside the hook itself, in the top half. Follow the instructions carefully!

but I have no idea what the heck that means. Plus in the description is says this hack is totally customizable via the admincp?
hooks and plug-ins in the acp