PDA

View Full Version : Forms Hack


Pages : 1 [2] 3 4 5

Abe1
11-30-2005, 02:05 PM
It Keeps Telling Me:
Invalid Forum specified. If you followed a valid link, please notify the administrator

Do you have permissions to post new threads?

ShadowOne
11-30-2005, 02:48 PM
Do you have permissions to post new threads?

Yes.

Abe1
11-30-2005, 03:18 PM
Yes.

are you logged in? did the standard form work?

Clanshosting
11-30-2005, 04:44 PM
When will you have time?
Also to answer ShadowOne's question, it's probably because you called the form something different and are still using

"/newthread.php?do=form (change "form" to the name of your form )"

Abe1
11-30-2005, 04:46 PM
When will you have time?
Also to answer ShadowOne's question, it's probably because you called the form something different and are still using

"/newthread.php?do=form (change "form" to the name of your form )"

To figger out how to add more then one vb message box to a form? I will see.

Clanshosting
11-30-2005, 05:16 PM
Well, I could live with one I think if you dont have time.

ShadowOne
11-30-2005, 06:02 PM
When will you have time?
Also to answer ShadowOne's question, it's probably because you called the form something different and are still using

"/newthread.php?do=form (change "form" to the name of your form )"

I did i tryed both, form and then the new form name i made, and it gives me that....

Abe1
11-30-2005, 08:27 PM
I did i tryed both, form and then the new form name i made, and it gives me that....

Do you have another hack that uses the same hook location?

silurius
11-30-2005, 10:45 PM
Abe, thanks for this update. I will start testing asap. Did you happen to address the sign a contract (http://showthread.php/?t=91867) plugin collision issue?

Couple of suggestions: I would recommend including bug fixes in the first post, and I would suggest ordering your version updates in reverse order as I have seen other vB mod-makers do.

Can't wait to test this out!

Abe1
12-01-2005, 01:53 AM
Abe, thanks for this update. I will start testing asap. Did you happen to address the sign a contract (http://showthread.php/?t=91867) plugin collision issue?

Couple of suggestions: I would recommend including bug fixes in the first post, and I would suggest ordering your version updates in reverse order as I have seen other vB mod-makers do.

Can't wait to test this out!

I did not look at the 'sign-a contract'. How about ask him to figure out the problem :D

I didn't write a list of what i had done so I forgot everything to include some bug fixes in the post.

I like puting the most recent updates on the bottom.

murrtex
12-02-2005, 06:13 PM
I installed and I click newthread.php?do=form and I fill and sent,but I can not read generic form topic because it says no permissions.that was the first question.and the second is;
I want to create a new form for aplication moderators what should I do?
thnx

silurius
12-02-2005, 09:24 PM
I did not look at the 'sign-a contract'. How about ask him to figure out the problem :D

Already did, and Amy hasn't had the chance to look into it as far as I can tell (just PM'd her).

Hopefully one of you can find the time in the near term, as these would both be extremely useful to have.

Thanks again for the update - as I said, I will let you know when I've tested.

apdcanari
12-03-2005, 06:47 AM
Hello,

I have a problem with this hack.

I cannot create new subjects. As regards answering in a given message, Ca functions. But not for the creation again in a given forum. It gives me has each invalid time URL.

Thank you,

Cédric :ermm:

SlimWicked
12-03-2005, 07:20 PM
wow! This seems like a GREAT Hack..Now this is the one question I can't seem to find the answer to. Lets say I have a mp3 post forum and a form to submit info on the mp3. Now when someone enters the mp3 forum, were do I go or how do I edit the "Post a topic or start new thread button" so that is points to the

hxxp://www.mysite.com/newthread.php?do=Mp3Post

I just can't seem to figure this one out. Sorry if this is a dumb question. :ermm:

Abe1
12-03-2005, 10:32 PM
wow! This seems like a GREAT Hack..Now this is the one question I can't seem to find the answer to. Lets say I have a mp3 post forum and a form to submit info on the mp3. Now when someone enters the mp3 forum, were do I go or how do I edit the "Post a topic or start new thread button" so that is points to the

hxxp://www.mysite.com/newthread.php?do=Mp3Post

I just can't seem to figure this one out. Sorry if this is a dumb question. :ermm:

Make a like some were to it. You can also creat a sub-form with the link.

SlimWicked
12-04-2005, 12:18 AM
Make a like some were to it. You can also creat a sub-form with the link.


Thanks Abe for the info. I saw on another forum (can't remember which one exactly) that uses your form hack and on there "post new thread" button was the link to there form. I was just wondering how do you or if you can do that.

Abe1
12-04-2005, 12:29 AM
Thanks Abe for the info. I saw on another forum (can't remember which one exactly) that uses your form hack and on there "post new thread" button was the link to there form. I was just wondering how do you or if you can do that.

It's a little hard to to do that. I like the idea and may eventualy create a hack that can do that.

Skyline_GT
12-04-2005, 01:28 AM
How come I got this error??

Warning: Division by zero in /includes/functions.php(4300) : eval()'d code on line 10

Abe1
12-04-2005, 01:29 AM
How come I got this error??

Warning: Division by zero in /includes/functions.php(4300) : eval()'d code on line 10

I've got no clue.

Skyline_GT
12-04-2005, 01:35 AM
I rename my $formname to mod_application

and when I try to go http://www.gamerzplanet.net/forums/newthread.php?do=mod_application

Abe1
12-04-2005, 01:37 AM
I rename my $formname to mod_application

and when I try to go http://www.gamerzplanet.net/forums/newthread.php?do=mod_application

Can you PM me a test username and pass?

RMS-Chef
12-04-2005, 05:29 AM
wow! This seems like a GREAT Hack..Now this is the one question I can't seem to find the answer to. Lets say I have a mp3 post forum and a form to submit info on the mp3. Now when someone enters the mp3 forum, were do I go or how do I edit the "Post a topic or start new thread button" so that is points to the

hxxp://www.mysite.com/newthread.php?do=Mp3Post

I just can't seem to figure this one out. Sorry if this is a dumb question. :ermm:

This is pretty easy. I searched for the post where I found the info but came up dry. I think I found it on vbulletin.com and it explained it better than I am about to.

Template is FORUMDISPLAY

Find this section of the default code:

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


Now if you just have one forum where you want the New Thread button to go to a specific form intead of the regular editor, replace the above code with the code below.

<td class="smallfont"><if condition="$show['newthreadlink']"><a href="<if condition="$foruminfo['forumid'] == XX">newthread.php?do=formXX<else />newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]</if>" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if></td>


Make sure to replace XX in the $foruminfo['forumid'] == XX to the forum ID number of the forum you want this to happen in.
And change formXX to the name of your forum (in your case Mp3Post) that you want to be taken to when the button is clicked in that forum,


Now if you have more than one forum with more than one form you can do that too. Say you have your MP3 forum and a different movie forum, each with a different form you want it to go to when you click the New Thread button you just simply add more conditionals and closing if statements.

So for two of them you could use:

<td class="smallfont"><if condition="$show['newthreadlink']"><a href="<if condition="$foruminfo['forumid'] == XX">newthread.php?do=formXX<else /><if condition="$foruminfo['forumid'] == YY">newthread.php?do=formYY<else />newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]</if></if>" rel="nofollow"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if></td>


Now when you are in forum XX and click the New Thread button you will be taken to the forum formXX and when you are in forum YY and click the New Thread button you will instead be taken to formYY. Of course as with the first modifaction, you are are in any forum other than the one or two you are replacing, you will be taken to the normal new thread editor.

To do this with three or more different forums, just add:

<if condition="$foruminfo['forumid'] == XX">newthread.php?do=formXX<else />

in the appropriate spot and another closing:

</if>

before

" rel="nofollow">

for each new forum that you want the New Thread button's behavior to change.


I hope this is what you were asking for and I also hope I explained it well enough for you. Good Luck!

Skyline_GT
12-04-2005, 06:33 AM
Can you PM me a test username and pass?

test what? It doesn't require member to viwe that.

Abe1
12-04-2005, 12:18 PM
test what? It doesn't require member to viwe that.

i got a no permissions page when I clicked on it.

KFrancesco
12-04-2005, 01:20 PM
Hello,

I have a little problem with this hack, the title of all post generated are fixed (var $posttitle = "$formtitle"), how can I make to choose the title to the user?

Thank you

RMS-Chef
12-04-2005, 02:13 PM
Hello,

I have a little problem with this hack, the title of all post generated are fixed (var $posttitle = "$formtitle"), how can I make to choose the title to the user?


Thank you

Check posts #35 & #42 in this thread.

apdcanari
12-04-2005, 02:54 PM
Hello,

I have an error.

Can you help me, please ?

Thanks,

Cédric :ermm:

apdcanari
12-04-2005, 03:30 PM
Re,

The error is here.

forumid = 0

How change this ?

Thanks,

Cédric :ermm:

KFrancesco
12-04-2005, 03:39 PM
Check posts #35 & #42 in this thread.
Perfect, how can I make to remove the variable "$question1" from the post but not to form?

Martyjp
12-04-2005, 09:10 PM
Since upgrading long answers no longer show up, any ideas?

ChrisBaktis
12-04-2005, 11:35 PM
Since upgrading long answers no longer show up, any ideas?

I thought I was the only one - I have been killing myself today trying to figure out why everything shows except long answers - the questions show just fine but when I post the form to a thread the long answers do not show.

Skyline_GT
12-05-2005, 01:53 AM
i got a no permissions page when I clicked on it.

please try again..
fixed.

Abe1
12-05-2005, 12:04 PM
I thought I was the only one - I have been killing myself today trying to figure out why everything shows except long answers - the questions show just fine but when I post the form to a thread the long answers do not show.

Can you PM your plug-in? Make sure to wrap it in php tags.

Abe1
12-05-2005, 12:07 PM
please try again..
fixed.

Go look at your plug-ins. It has something to do with a global_complete plug-in.

ChrisBaktis
12-05-2005, 12:22 PM
Can you PM your plug-in? Make sure to wrap it in php tags.

I had something more then this but when I couldnt get it to work I started from scratch to see if something was missed. Im actually trying to do a form with 1 Normal question and 2 long questions and that is it.

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

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

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

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

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

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

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$radioanswer2 = $vbulletin->GPC['radioanswer2'];
$radioanswer3 = $vbulletin->GPC['radioanswer3'];
$radioanswer3other = $vbulletin->GPC['radioanswer3other'];
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];

////////////////////////////////////////////////////////////////////////////////////////////////////
//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(15,19,22,26,24,27,28,5,6,13))) 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 = "forms_memup_link";
// Name of the answer template
$answertemplate = "forms_memup_link_answers";

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

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

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

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

//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 - 1 = yes, 0 = no
$formpm = "0";

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

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

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

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

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

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

$redirectoption = "0";

$errormessage = "Thank you for submitting 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)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Member Promotion Awards 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 = "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)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion1 = "Current Email Address";

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

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

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

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

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

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

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

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

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

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

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$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)
$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)
$question3 = "What is your website?";
$explain3 = "Please enter your URL here.";

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

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

$dropdownquestion1 = "What is your gender?";

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

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

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

$longquestion1 = "Full Name & Mailing Address";
$longexplain1 = "Without this information we cannot send out your award";

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

if ($formforum == "1")
{
$foruminfo = verify_id('forum', $formforumid, 0, 1);
$forumperms = fetch_permissions($foruminfo[forumid]);
$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');

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

Abe1
12-05-2005, 12:25 PM
I had something more then this but when I couldnt get it to work I started from scratch to see if something was missed. Im actually trying to do a form with 1 Normal question and 2 long questions and that is it.

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

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

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

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

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

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

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$radioanswer2 = $vbulletin->GPC['radioanswer2'];
$radioanswer3 = $vbulletin->GPC['radioanswer3'];
$radioanswer3other = $vbulletin->GPC['radioanswer3other'];
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];

////////////////////////////////////////////////////////////////////////////////////////////////////
//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(15,19,22,26,24,27,28,5,6,13))) 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 = "forms_memup_link";
// Name of the answer template
$answertemplate = "forms_memup_link_answers";

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

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

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

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

//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 - 1 = yes, 0 = no
$formpm = "0";

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

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

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

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

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

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

$redirectoption = "0";

$errormessage = "Thank you for submitting 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)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Member Promotion Awards 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 = "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)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion1 = "Current Email Address";

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

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

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

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

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

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

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

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

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

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

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$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)
$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)
$question3 = "What is your website?";
$explain3 = "Please enter your URL here.";

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

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

$dropdownquestion1 = "What is your gender?";

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

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

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

$longquestion1 = "Full Name & Mailing Address";
$longexplain1 = "Without this information we cannot send out your award";

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

if ($formforum == "1")
{
$foruminfo = verify_id('forum', $formforumid, 0, 1);
$forumperms = fetch_permissions($foruminfo[forumid]);
$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');

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

I think I know what the problem is. Compare your custom template with the new template and see how the long_answer is done. All you need is $message_area.

Martyjp
12-05-2005, 12:31 PM
just pm'ed you about this as well, thanks

Abe1
12-05-2005, 12:33 PM
just pm'ed you about this as well, thanks

Can you check what I just answered him?

I think I know what the problem is. Compare your custom template with the new template and see how the long_answer is done. All you need is $message_area.

ChrisBaktis
12-05-2005, 12:35 PM
this is how i call the long question in the template.

<b>$longquestion1<b><br>
$longexplain1<br>
<textarea rows="5" cols="50" name="longanswer1"></textarea>

Abe1
12-05-2005, 12:37 PM
this is how i call the long question in the template.

<b>$longquestion1<b><br>
$longexplain1<br>
<textarea rows="5" cols="50" name="longanswer1"></textarea>

Change this:
<textarea rows="5" cols="50" name="longanswer1"></textarea>
to:
$message_area

ChrisBaktis
12-05-2005, 12:40 PM
Do I just replace 'textarea' with $message_area? if not how would I customize the size of the area?

Abe1
12-05-2005, 12:42 PM
Do I just replace 'textarea' with $message_area? if not how would I customize the size of the area?

You replace the whole textarea with $message_area. It will put the vb editor there. It get costomized by user's defaults. You can also look at the origonal template to see how exactly it's put in.

ChrisBaktis
12-05-2005, 12:45 PM
thanks for the help - I kept looking for that form template thinking it would be located with other custom templates but it was farther down - never looked that far down - that could of elminated all this - thank you VERY much for your patience and help.

ChrisBaktis
12-05-2005, 12:51 PM
One last question on this....is there a way to get a text area box with out the whole editor? Im trying to ask members for a mailing address that only needs to be a couple of lines and would have no use for a whole editor.

Abe1
12-05-2005, 12:53 PM
One last question on this....is there a way to get a text area box with out the whole editor? Im trying to ask members for a mailing address that only needs to be a couple of lines and would have no use for a whole editor.

Yes. Use the old text area but chane the name to something else. Make sure you add the new varable to the plug-in.

ChrisBaktis
12-05-2005, 12:55 PM
GREAT thanks!

Martyjp
12-05-2005, 01:05 PM
Can you check what I just answered him?

Tried that but it hasnt worked, the vbeditor is there but whatever you put in it still dosent show, will have to take a longer look at it later when i get home from work

PtP
12-05-2005, 10:21 PM
Thank you very much Abe this has got to be the most usefull and adaptable addition to any vbulletin forum out there ;)

One thing I would love to do is force the form to use a particular style rather than the default one that the forums are using, what would be the easiest way to archieve this?

ZGeek
12-05-2005, 10:38 PM
I'm getting this error. Anyone got any idea?

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

ZGeek
12-05-2005, 11:09 PM
Ahh I figured that one out. I was trying to PM the form, but my character limit was too small for the stuff it was trying to send.

Ramsesx
12-06-2005, 04:49 AM
I tranfered my settings from 2.7 to 3.0 and get now this error:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/www/web153/html/forum/newthread.php(68) : eval()'d code on line 34
that's my 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,
'dropanswer1' => TYPE_STR,
'radioanswer1' => TYPE_STR,
'radioanswer2' => TYPE_STR,
'radioanswer3' => TYPE_STR,
'radioanswer3other' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR
'answer3' => TYPE_STR,
'longanswer1' => TYPE_STR

));

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$normalanswer2 = $vbulletin->GPC['normalanswer2'];
$dropanswer1 = $vbulletin->GPC['dropanswer1'];
$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'];
$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 = "231";

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

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

//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 - 1 = yes, 0 = no
$formpm = "1";

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

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

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

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

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

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

$redirectoption = "0";

$errormessage = "$vbphrase[errormessage]"; //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 = "Modell Bericht";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "$vbphrase[formpurpose]";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 1 (Name der Agentur (wenn bei keiner Feld bitte auslassen):)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion1 = "$vbphrase[normalquestion1]";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 1 (Name des Modells:)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion2 = "$vbphrase[normalquestion2]";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//DROP DOWN BOX : QUESTION 1 (Haarfarbe:)
////////////////////////////////////////////////////////////////////////////////////////////////////

$dropquestion1 = "Haarfarbe";

$drop1 = "blond";
$drop2 = "schwarz";
$drop3 = "braun";
$drop4 = "brunett";
$drop5 = "rot";
$drop6 = "lila";
$drop7 = "sonstige";

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

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

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

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

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

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

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

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

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$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)
$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)
$question3 = "What is your website?";
$explain3 = "Please enter your URL here.";

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


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

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

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

if ($formforum == "1")
{
$foruminfo = verify_id('forum', $formforumid, 0, 1);
$forumperms = fetch_permissions($foruminfo[forumid]);
$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');

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

Abe1
12-06-2005, 12:05 PM
I tranfered my settings from 2.7 to 3.0 and get now this error:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/www/web153/html/forum/newthread.php(68) : eval()'d code on line 34
that's my 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,
'dropanswer1' => TYPE_STR,
'radioanswer1' => TYPE_STR,
'radioanswer2' => TYPE_STR,
'radioanswer3' => TYPE_STR,
'radioanswer3other' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR
'answer3' => TYPE_STR,
'longanswer1' => TYPE_STR

));

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$normalanswer2 = $vbulletin->GPC['normalanswer2'];
$dropanswer1 = $vbulletin->GPC['dropanswer1'];
$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'];
$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 = "231";

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

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

//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 - 1 = yes, 0 = no
$formpm = "1";

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

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

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

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

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

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

$redirectoption = "0";

$errormessage = "$vbphrase[errormessage]"; //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 = "Modell Bericht";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "$vbphrase[formpurpose]";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 1 (Name der Agentur (wenn bei keiner Feld bitte auslassen):)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion1 = "$vbphrase[normalquestion1]";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 1 (Name des Modells:)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion2 = "$vbphrase[normalquestion2]";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//DROP DOWN BOX : QUESTION 1 (Haarfarbe:)
////////////////////////////////////////////////////////////////////////////////////////////////////

$dropquestion1 = "Haarfarbe";

$drop1 = "blond";
$drop2 = "schwarz";
$drop3 = "braun";
$drop4 = "brunett";
$drop5 = "rot";
$drop6 = "lila";
$drop7 = "sonstige";

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

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

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

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

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

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

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

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

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$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)
$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)
$question3 = "What is your website?";
$explain3 = "Please enter your URL here.";

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


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

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

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

if ($formforum == "1")
{
$foruminfo = verify_id('forum', $formforumid, 0, 1);
$forumperms = fetch_permissions($foruminfo[forumid]);
$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');

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



You are missing a comma after 'answer2' => TYPE_STR

Ramsesx
12-06-2005, 01:22 PM
You are missing a comma after
That's it, thanks Abe.

lanc3lot
12-06-2005, 03:01 PM
Can i see any shot / demo for this?

Searched the thread but no luck :(

PtP
12-06-2005, 09:15 PM
One thing I would love to do is force the form to use a particular style rather than the default one that the forums are using, what would be the easiest way to archieve this?

So nobody else has needed this feature? I have hosted forums on my server and would love to use this for projects on the hosted forums using their style rather than my default style.

Abe1
12-07-2005, 12:43 PM
Version 3.1:

Brought back the standard text box (longanswer)


I also renamed what the vbtext box now uses. $vbtextquestion, $vbtextexplain, and $vbtextanswer are used for the vb text editor box.

fabianv
12-07-2005, 04:45 PM
I tried adding a second form on vb 3.5.1 but it wont work when I access

/newthread.php?do=form2

Where did I make my mistake?

Abe1
12-07-2005, 04:52 PM
1) templatetype should not be changed.

2) formanswers template should be renamed formanswers2

fabianv
12-07-2005, 07:49 PM
Thank you for taking the time to help me.

Everything works perfectly now!

Abe1
12-07-2005, 07:54 PM
Thank you for taking the time to help me.

Everything works perfectly now!

NP. The 2 problems were stairing me in the face. From the time you posted, my reply was 7 min. later. How much time could it have taken :)

djlotus
12-07-2005, 08:38 PM
Thanks so much fro the update.

Skyline_GT
12-07-2005, 09:33 PM
Can you PM your plug-in? Make sure to wrap it in php tags.

can you give me more details??

lanc3lot
12-08-2005, 08:26 AM
Hm demo / ss?

Abe1
12-08-2005, 12:17 PM
Hm demo / ss?

I posted a picture in the main post.

lanc3lot
12-08-2005, 12:40 PM
Thnx, going to install it now :)

Martyjp
12-08-2005, 02:07 PM
Got it all working now :)

One request, is it at all possible to make the polls that the form creates public so its possible to see who voted rather than having to go into the admincp each time?

Abe1
12-08-2005, 05:30 PM
Got it all working now :)

One request, is it at all possible to make the polls that the form creates public so its possible to see who voted rather than having to go into the admincp each time?

I'll try to give that otpion for next version.

2fast4ya
12-08-2005, 05:40 PM
can this be hooked into the "create new thread" button in the forums for certain forums. For instance... i have a website that users can buy, sell, and trade domain names, and this would be useful if i can hook it into that button. But make it different for each forum. could that be done? Specifically to a CERTAIN forum? if so, how?

Abe1
12-08-2005, 06:41 PM
can this be hooked into the "create new thread" button in the forums for certain forums. For instance... i have a website that users can buy, sell, and trade domain names, and this would be useful if i can hook it into that button. But make it different for each forum. could that be done? Specifically to a CERTAIN forum? if so, how?

I may try to make an add on to this hack doing something like this.

websiteicons.co
12-08-2005, 06:47 PM
can this be hooked into the "create new thread" button in the forums for certain forums. For instance... i have a website that users can buy, sell, and trade domain names, and this would be useful if i can hook it into that button. But make it different for each forum. could that be done? Specifically to a CERTAIN forum? if so, how?

I was going to ask the same question. I also have a site where users can buy, sell or trade domains etc...

leroub
12-09-2005, 01:47 AM
i have a problem... i put "mysite/newthread.php?do=form" ... and i have a blank page ???

thanks for your help...

---------------------------------------

Thanks for your help... but i found my prob... i forget 1 comma.... :rolleyes:

Abe1
12-09-2005, 12:56 PM
Version 3.2: (12/09/2005)

[ADDED] Option to make polls public.

Ramsesx
12-09-2005, 01:17 PM
Thanks for the new version, only one question, the vb message box isn't there anymore?

Abe1
12-09-2005, 06:28 PM
Thanks for the new version, only one question, the vb message box isn't there anymore?

You have to give me more info then just that.

silurius
12-09-2005, 08:19 PM
Put as the thread title "$user[userid]'s Interview".

Hi Abe,

I've tested the updates and all is well for the most part. I am a bit confused about how to set the thread title to include the submitter's name. As directed above, I've edited line # 358 to be this, but the thread still ommits the username:

$posttitle = "$user[userid]'s story submission"; yields: 's story submission

Ramsesx
12-10-2005, 03:22 AM
You have to give me more info then just that.
Ok, sorry, I installed the versions 2.7, 3.0,3.1,3.2 but I never saw a box (attached image) as in your form screenshot, how can I get this into my form?
Thanks

Abe1
12-10-2005, 09:06 PM
Ok, sorry, I installed the versions 2.7, 3.0,3.1,3.2 but I never saw a box (attached image) as in your form screenshot, how can I get this into my form?
Thanks

You have to compare the templates.

Abe1
12-10-2005, 09:08 PM
Hi Abe,

I've tested the updates and all is well for the most part. I am a bit confused about how to set the thread title to include the submitter's name. As directed above, I've edited line # 358 to be this, but the thread still ommits the username:

$posttitle = "$user[userid]'s story submission"; yields: 's story submission

It should be $bbuserinfo[userid]

if that doesn't work, put on the line before, $bbuserinfo = $vbulletin->userinfo,

lanc3lot
12-11-2005, 04:08 PM
What u do mean, when u are saying:

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

How can i edit? U mean through the edit on Products?

Abe1
12-11-2005, 06:51 PM
What u do mean, when u are saying:

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

How can i edit? U mean through the edit on Products?

plug-ins

SupermanInNY
12-12-2005, 10:45 PM
can this be hooked into the "create new thread" button in the forums for certain forums. For instance... i have a website that users can buy, sell, and trade domain names, and this would be useful if i can hook it into that button. But make it different for each forum. could that be done? Specifically to a CERTAIN forum? if so, how?

I second that!
I have a Review/Feedback forum and the "New Thread" in that particular forum should create this form as each thread is a review/feedback on it's own.

However, of course in the other forums it is regular posts, so the "New Thread" should simply create a new thread.

This will be a very welcome and desirable feature.

Thanks for the great work so far!

-Alon.

Skyline_GT
12-13-2005, 01:20 AM
can you give me more details??

anyone please?
https://vborg.vbsupport.ru/showpost.php?p=843125&postcount=312

JayJay
12-13-2005, 09:35 AM
Any ideas why I am encountering the following error?

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

showthread.php?p=

It does not seem to want to post nor redirect me.

Abe1
12-13-2005, 11:59 AM
Any ideas why I am encountering the following error?

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

showthread.php?p=

It does not seem to want to post nor redirect me.

What are you making? (thread/post/pm/email)

What is your redirect option set to?

JayJay
12-13-2005, 12:35 PM
Tried creating a post. I've uploaded the original product and only changed the forumid I wish the form to post to and the option.

I've tried options 1, 2, and 3.

I had a conflict when using the Contract hack, but disabled and uninstalled that now. I thought maybe it was that causing the problems.

Abe1
12-13-2005, 03:05 PM
Tried creating a post. I've uploaded the original product and only changed the forumid I wish the form to post to and the option.

I've tried options 1, 2, and 3.

I had a conflict when using the Contract hack, but disabled and uninstalled that now. I thought maybe it was that causing the problems.

I'll have to look into it. Can you PM me how your plug-in looks now. Please send it in PHP tags.

Abe1
12-14-2005, 01:58 AM
I have created a hack that allows you to set were the "New Thread button goes to. https://vborg.vbsupport.ru/showthread.php?t=102923

silurius
12-14-2005, 02:18 AM
I have created a hack that allows you to set were the "New Thread button goes to. https://vborg.vbsupport.ru/showthread.php?t=102923Once again, fantastic work. I'll definitely have use for this! Would also love to have dropdown options determine the destination of the output.

Assuming the New Thread hack can't be tweaked to accomplish this, could you add that request to the pile?

:)

Abe1
12-14-2005, 02:47 AM
Once again, fantastic work. I'll definitely have use for this! Would also love to have dropdown options determine the destination of the output.

Assuming the New Thread hack can't be tweaked to accomplish this, could you add that request to the pile?

:)

I'll try to post a way to do this some time.

tidy_boy
12-14-2005, 05:59 PM
How do I create a form?

Thanks

silurius
12-14-2005, 06:43 PM
How do I create a form?

Thanks
As Abe has said in this thread, the setup instructions are all in the XML file, although they are spread out a bit and it might require a bit of troubleshooting to master. The general process I followed was:1. Make a copy of product-form_hack.xml - name the file according to what kind of form you're creating for your own tracking purposes.
2. Edit product id to correspond with what you are creating
3. Edit title & description ""
4. Edit $formname "" (no spaces or weird characters, underscore is ok)
5. Study the "Customize Variables" section (begins at line 229 I think).
- You can leave any variables you don't plan to use there
6. Edit the "Usergroups Allowed" section according to your needs (line 273)
7. If you plan to create more than one form, edit the Templates section (starts @ line 278)
8. Continue editing the options that follow as needed.
9. Save & upload the product.
10. Call the form using http://www.YOURSITE.com/forum/newthread.php?do=[whatever you put as $formname]
It only took a couple of tries before I got the hang of it and it works like a champ.

tidy_boy
12-14-2005, 07:38 PM
Thanks mate I see what you mean about getting the hang of it.

Can you have image uploads on the forms as well

Abe1
12-14-2005, 08:04 PM
Thanks mate I see what you mean about getting the hang of it.

Can you have image uploads on the forms as well

Use the option to farward your users to the edit post page.

silurius
12-14-2005, 09:15 PM
Thanks mate I see what you mean about getting the hang of it.

Can you have image uploads on the forms as well
Use the option to farward your users to the edit post page.

Although the button for it is not actually shown, using https://vborg.vbsupport.ru/ in the WYSIWYG box has worked for me.

But because my submissions go to a private area, I'm still on the lookout for an upload feature which does not require that the user visit the forum where their post ended up.http://asdfasfd

Noonster
12-15-2005, 08:28 AM
Would it be possible to add a paypal field to it so they can actually pay via the form??

IE....
- Complete form with details needed, name, address etc...
- Then at the end is a payment box where they enter their paypal email addy and it sends the money to our paypal account and the form is then pm/emailed to an admin as normal.

That would be great and your help much appreciated!

Cheers
Daz

apdcanari
12-15-2005, 11:15 AM
Any ideas why I am encountering the following error?

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

showthread.php?p=

It does not seem to want to post nor redirect me.

Hello,

I have the same error.

Can you help me, please ?

Thanks,

C?dric :ermm:

Abe1
12-15-2005, 12:29 PM
Hello,

I have the same error.

Can you help me, please ?

Thanks,

C?dric :ermm:

Was the thread created?

apdcanari
12-15-2005, 01:07 PM
My config

Thanks,

Cédric :ermm:

utw-Mephisto
12-15-2005, 01:55 PM
Great hack and it works like a charm, however, configuration could be easier through a gui, automatic template creation when using more than one form would be better and the created thread could look a bit better too :)

But this are just my .5c

Abe1
12-15-2005, 02:01 PM
My config


Thanks,

C?dric :ermm:

Does the thread get created?

Noonster
12-15-2005, 02:13 PM
Great hack and it works like a charm, however, configuration could be easier through a gui, automatic template creation when using more than one form would be better and the created thread could look a bit better too :)

But this are just my .5c

Also agree with this... however after a bit of work it does exactly what its supposed to and works a treat :D

apdcanari
12-15-2005, 02:32 PM
Does the thread get created?

No :ermm:

Thread > NO
Post > OK
PM > OK
Email > OK

Abe1
12-15-2005, 03:44 PM
No :ermm:

Thread > NO
Post > OK
PM > OK
Email > OK

Make sure your settings for the forum allows for new threads.

apdcanari
12-15-2005, 03:55 PM
Make sure your settings for the forum allows for new threads.


Oh yes, but i have a lot of hacks...

http://www.apdcanari.com/forum

Abe1
12-15-2005, 03:57 PM
Oh yes, but i have a lot of hacks...

http://www.apdcanari.com/forum

What happens when you set to go to an other forumid?

apdcanari
12-15-2005, 04:02 PM
What happens when you set to go to an other forumid?

No change... :ermm:

Abe1
12-15-2005, 04:03 PM
No change... :ermm:

I would have to test on your forum when I have time.

apdcanari
12-15-2005, 04:06 PM
I would have to test on your forum when I have time.

Oki, no problem.

Thanks a lot,

C?dric ;-)

utw-Mephisto
12-16-2005, 09:22 AM
Also agree with this... however after a bit of work it does exactly what its supposed to and works a treat :D

Sure thing .. I am using it for sure, but I simply dont have the time to create the forms I need (two in total) .. but as you said : Its working great ;)

utw-Mephisto
12-16-2005, 09:24 AM
Just a question for understanding, to change the actuall look of the created form I need to modify the template ?

Abe1
12-16-2005, 11:54 AM
Just a question for understanding, to change the actuall look of the created form I need to modify the template ?

Yes.

BiReL41r
12-16-2005, 07:51 PM
Wow, yet another great hack. Best hack for applications to a website.

dsotmoon
12-17-2005, 07:06 PM
wow, how have i missed this all this time, will install today, thanks

silurius
12-17-2005, 07:48 PM
Abe did you post a PayPal link? I'd like to tip as this has been a great help to my project.

Abe1
12-17-2005, 09:44 PM
Abe did you post a PayPal link? I'd like to tip as this has been a great help to my project.

Thanx alot, it would be appreciated. I just posted a link in the main post.

cclaerhout
12-18-2005, 12:51 PM
Thanx alot, it would be appreciated. I just posted a link in the main post.

Thanks for this great hack.
I have just a little question

When i'm connected as a guest and try to submit the form :
email sending is working
pm sending is not working
opening a new thread in a specified forum is not working.

But all theses tree functions are working if i'm connected as a member.

I've given guests the ability to "open" new threads in the specified forum (but they still can't see the forum), but it still doesn't work.

And i don't know why PM sending by a guest don't work.

Where did i make a mistake ? ;)

Abe1
12-18-2005, 03:09 PM
Thanks for this great hack.
I have just a little question

When i'm connected as a guest and try to submit the form :
email sending is working
pm sending is not working
opening a new thread in a specified forum is not working.

But all theses tree functions are working if i'm connected as a member.

I've given guests the ability to "open" new threads in the specified forum (but they still can't see the forum), but it still doesn't work.

And i don't know why PM sending by a guest don't work.

Where did i make a mistake ? ;)

I never realy did tests with Guests. I will soon try to by pass all the vb permissions but still use their functions so everything goes smoothly.

Guests can't send PM's as far as I know.

Spinball
12-18-2005, 05:06 PM
Apologies, Abe (and others), but I need a bit of help, please.
I want to call the form with a passed forum number.
I have put the variable in thus:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'advert_type' => TYPE_STR,
'advert_title' => TYPE_STR,
'location' => TYPE_STR,
'confirmation' => TYPE_STR,
'f' => TYPE_STR
));

// Part 2
$advert_type = $vbulletin->GPC['advert_type'];
$advert_title = $vbulletin->GPC['advert_title'];
$location = $vbulletin->GPC['location'];
$confirmation = $vbulletin->GPC['confirmation'];
$f = $vbulletin->GPC['f'];

and
$formforumid = $f;
if (strlen($formforumid) == 0) {
$errormessage = $vbulletin->userinfo['username'] . ", Fatal Error - please contact admin and tell them the formforumid variable was blank when trying to create a new classified advert. Thanks!";
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
exit();
}
Yet when I call the script thus:
http://www.avforums.com/forums/newthread.php?do=classifieds_form&f=115
I get the error message.
If I hard code the forum number in, it works perfectly.
Why is $f null?
Thanks in advance.

Abe1
12-18-2005, 05:51 PM
Apologies, Abe (and others), but I need a bit of help, please.
I want to call the form with a passed forum number.
I have put the variable in thus:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'advert_type' => TYPE_STR,
'advert_title' => TYPE_STR,
'location' => TYPE_STR,
'confirmation' => TYPE_STR,
'f' => TYPE_STR
));

// Part 2
$advert_type = $vbulletin->GPC['advert_type'];
$advert_title = $vbulletin->GPC['advert_title'];
$location = $vbulletin->GPC['location'];
$confirmation = $vbulletin->GPC['confirmation'];
$f = $vbulletin->GPC['f'];

and
$formforumid = $f;
if (strlen($formforumid) == 0) {
$errormessage = $vbulletin->userinfo['username'] . ", Fatal Error - please contact admin and tell them the formforumid variable was blank when trying to create a new classified advert. Thanks!";
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
exit();
}
Yet when I call the script thus:
http://www.avforums.com/forums/newthread.php?do=classifieds_form&f=115
I get the error message.
If I hard code the forum number in, it works perfectly.
Why is $f null?
Thanks in advance.

You can't use 'f'. It is reserved for a fourmid.

cclaerhout
12-18-2005, 05:55 PM
You can't use 'f'. It is reserved for a fourmid.

Thanks for your answer Abe1. I'm waiting after your tests :)

Spinball
12-18-2005, 07:45 PM
You can't use 'f'. It is reserved for a fourmid.
I'm trying to use it as the forumid as per your suggestion in the code
//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.

and use 'f' to post the new thread in the forum with id 'f'.
And indeed if I change 'f' to 'post_to_forum' it still fails.
:confused:

Abe1
12-18-2005, 08:56 PM
I'm trying to use it as the forumid as per your suggestion in the code

and use 'f' to post the new thread in the forum with id 'f'.
And indeed if I change 'f' to 'post_to_forum' it still fails.
:confused:

OK.

Skip the f part and automaticly if you do f= in the url, the varible $forumid will equal it. dont add it to the part on2 and part 2.

WNxWakko
12-18-2005, 09:06 PM
There must be a way to get this form to allow people not registered on the board to submit it. PLEASE!!!

Spinball
12-18-2005, 09:16 PM
OK.

Skip the f part and automaticly if you do f= in the url, the varible $forumid will equal it. dont add it to the part on2 and part 2.
Thanks. That got the page up, but when I posted the form I got
Warning: Cannot use a scalar value as an array in /includes/functions_newpost.php on line 331
Sorry to be a pain, but any ideas?

Abe1
12-18-2005, 09:18 PM
Thanks. That got the page up, but when I posted the form I got

Sorry to be a pain, but any ideas?

Nope. Just make sure you dont have any where you are change what f or forumid equals to.

WNxWakko
12-18-2005, 09:56 PM
Ok I have a new question for ya.

I have a custom profile field field41 that is a dropdown menu with over 40 games listed. I use that to display what games members are playing.

So lets say I want that field to show up in your form, same dropdown list of those games, but it pull the games you can select from the list of the custom profile field. How or can this be done?

Abe1
12-18-2005, 09:58 PM
Ok I have a new question for ya.

I have a custom profile field field41 that is a dropdown menu with over 40 games listed. I use that to display what games members are playing.

So lets say I want that field to show up in your form, same dropdown list of those games, but it pull the games you can select from the list of the custom profile field. How or can this be done?

It mostlkly can be done just I dont have time right no.You would need a query that pulls the info and format it for the form.

Daniel
12-19-2005, 03:35 AM
How do you remove certain fields? I mean, I deleted them from the customization, but they're there but blank.

SLGR
12-19-2005, 03:40 AM
I was looking forward for this hack.
I will read the thread and will install as soon as a finish upgrading to 3.5.2
Anyway, clicking install right now!

Spinball
12-19-2005, 08:31 AM
Nope. Just make sure you dont have any where you are change what f or forumid equals to.
Ah. Yes I do do that.
We have different forums for 'Wanted' adverts and 'For Sale' adverts.
If someone posts from either and selects the other option (i.e. posts a 'Wanted' advert from the 'For Sale' forum) then I (rather usefully, I thought) change the forumid so that the advert goes tot he right place.
if ($formforumid == 62) {
if ($advert_type == "Wanted:") {
$formforumid = 198;
}
} elseif ($formforumid == 198) {
if ($advert_type == "For Sale:" or $advert_type == "For Trade:") {
$formforumid = 62;
}
}

however I don't think that is the problem here since I am posting into forum 115.
I guess I'll have to struggle through it. Unless anyone can throw me a rope?
Thanks

pipin
12-19-2005, 09:14 AM
Similar thing like Spinball:

Wondering if i cant add the threadid in the form call like do=form&threadid=123766 to post the answers in that thread.
any change that i can adjust it to it and a hint - if possible - how?

Abe1
12-19-2005, 12:04 PM
Similar thing like Spinball:

Wondering if i cant add the threadid in the form call like do=form&threadid=123766 to post the answers in that thread.
any change that i can adjust it to it and a hint - if possible - how?

In the URL have $t=

In the plugin, have the threadid equal $threadinfo[threadid]

Abe1
12-19-2005, 12:43 PM
Version 3.3: (12/19/2005)

[FIXED] Guests can now post using the forms to make a thread or post. They cannot send a PM though.
[ADDED] Paypal link so you can make a donation for this hack.

pipin
12-19-2005, 01:55 PM
In the URL have $t=

In the plugin, have the threadid equal $threadinfo[threadid]

so i do this:


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


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

//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid = $threadinfo[threadid];



Opening the form with
http://www.xx.xxx/vbulletin//newthread.php?do=form&$t=84

causes
Warnung: Cannot use a scalar value as an array in /includes/functions_newpost.php (Zeile 258)

setting $formreplythreadid = "84"; works

Abe1
12-19-2005, 01:57 PM
so i do this:


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


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

//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid = $threadinfo[threadid];



Opening the form with
http://www.xx.xxx/vbulletin//newthread.php?do=form&$t=84

causes
Warnung: Cannot use a scalar value as an array in /includes/functions_newpost.php (Zeile 258)

setting $formreplythreadid = "84"; works

Link should be:
http://www.xx.xxx/vbulletin//newthread.php?do=form&t=84

pipin
12-19-2005, 02:01 PM
Link should be:
http://www.xx.xxx/vbulletin//newthread.php?do=form&t=84


still the same:

Warnung: Cannot use a scalar value as an array in /includes/functions_newpost.php (Zeile 258)

Datenbankfehler in vBulletin 3.5.2:

Invalid SQL:
SELECT postid FROM post WHERE threadid= ORDER BY dateline LIMIT 1;

MySQL-Fehler : You have an error in your SQL syntax near 'ORDER BY dateline LIMIT 1' at line 1
Fehler-Nr. : 1064

Noonster
12-19-2005, 04:58 PM
[ADDED] Paypal link so you can make a donation for this hack.

^^ I cant seem to find that or how to do it :( - Any ideas??

Abe1
12-19-2005, 05:57 PM
[ADDED] Paypal link so you can make a donation for this hack.

^^ I cant seem to find that or how to do it :( - Any ideas??

It's at the bottom of my first listing.

Stachel
12-19-2005, 06:17 PM
Thanks for this Abe1 !

Stachel

Spinball
12-19-2005, 08:13 PM
still the same:

Warnung: Cannot use a scalar value as an array in /includes/functions_newpost.php (Zeile 258)
That's the same kind of error I'm getting.

Daniel
12-19-2005, 08:29 PM
How do you remove certain fields? I mean, I deleted them from the customization, but they're there but blank.


anyone?

pipin
12-19-2005, 08:58 PM
How do you remove certain fields? I mean, I deleted them from the customization, but they're there but blank.

as stated before there are two templates : form and formanswers !

cclaerhout
12-19-2005, 11:43 PM
Thanks for this update !
Little question : how to update an existing installation. Do we have to update all plug-ins ?

Edit : that's good i've compared the two files and see what has changed.

WNxWakko
12-19-2005, 11:58 PM
How do I make the vbtext box required?

I am adding at such and its not working,

if ($answer1 == '' OR $messagearea == '')
{

cclaerhout
12-20-2005, 12:42 AM
Me again ; i've just finished to test guest function to open a new thread in a forum : IT WORKS GREAT :)

Thank you !

Abe1
12-20-2005, 11:51 AM
How do I make the vbtext box required?

I am adding at such and its not working,

if ($answer1 == '' OR $messagearea == '')
{

It's called '$vbtextanswer' but it's not made until AFTER the check. You would have to suffle some code around. I will move it around fronext version.

keroberos
12-23-2005, 01:26 AM
Keep getting this error when i try to create a new thread:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/fight/public_html/forums/newthread.php(68) : eval()'d code on line 1


any ideas?

Abe1
12-23-2005, 11:51 AM
Keep getting this error when i try to create a new thread:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/fight/public_html/forums/newthread.php(68) : eval()'d code on line 1


any ideas?

You have an error on the first line of the plug-in. Please make sure the line strats with //

keroberos
12-23-2005, 03:53 PM
You have an error on the first line of the plug-in. Please make sure the line strats with //

haha i knew i inputed something wrong somewhere i just couldnt find it, thanks and awsome job.

tommyxv
12-23-2005, 09:28 PM
I want to add a drop down for all 50 states.... what variable do i use after i use all 26 letters?

EX:

$dropdownchoice6z = "Georgia";

TCattitude
12-24-2005, 08:35 PM
How to make this mod work with Psionic Vision's "adv editing options (https://vborg.vbsupport.ru/showthread.php?t=98737&highlight=advanced+editing)"?.
With the two hacks installed, forms not finish... and don't do anything at all (not email sent, no thread created, no reply to thread, nothing). When disable the product "adv editing options", the formshack do their work again without flaw.

Any clue?
Please.

Abe1
12-24-2005, 09:38 PM
I want to add a drop down for all 50 states.... what variable do i use after i use all 26 letters?

EX:

$dropdownchoice6z = "Georgia";

use $dropdownchoice6aa

WNxWakko
12-24-2005, 10:11 PM
You do realize, you dont even need any of that complex coding for a dropdown selector.

Ive been making dropdowns on this form since he first released this.

For example on your form template all you do is this,

<select name="answer3">
<option selected></option>
<option>cows</option>
<option>rabbits</option>
<option>dogs</option>
<option>cats</option>
</select>

Just make sure the name of the dropdown is called answer1, answer2, answer3 and so on.

steven s
12-26-2005, 02:16 PM
This is terrific.
I am using it as an event registration form.
By creating additional profile fields users don't need to enter repetitive information.
I created a separate edit profile page. Then save it using the profile.php script. The person goes to the form and enters more info that is unique only to the one event.

Not sure if there is an easier way.

One snag. The form is sent to a specific email address but I need a copy also send to the person submitting the form $bbuserinfo[email], if that is correct?
Is it possible to send to two email addresses? If so, how?

I'd also like to have the form sent by PM to the user.
What if he/she has PM turned off?

Abe1
12-26-2005, 02:20 PM
This is terrific.
I am using it as an event registration form.
By creating additional profile fields users don't need to enter repetitive information.
I created a separate edit profile page. Then save it using the profile.php script. The person goes to the form and enters more info that is unique only to the one event.

Not sure if there is an easier way.

One snag. The form is sent to a specific email address but I need a copy also send to the person submitting the form $bbuserinfo[email], if that is correct?
Is it possible to send to two email addresses? If so, how?

I'd also like to have the form sent by PM to the user.
What if he/she has PM turned off?

Go look at the plugin where the actual code is to send an email. double that line and change the email where to go to $vbulletin->userinfo['email']

steven s
12-26-2005, 02:32 PM
Go look at the plugin where the actual code is to send an email. double that line and change the email where to go to $vbulletin->userinfo['email']YES!
So I can probably do the same to PM the user.
Thanks!

I Love NY too and miss it greatly. :disappointed:

Abe1
12-26-2005, 02:34 PM
YES!
So I can probably to the same to PM the user.
Thanks!

I Love NY too and miss it greatly. :disappointed:

PM will be alittle harder. There is some info prossesing before. You should copy the whole section and edit where needed.

steven s
12-26-2005, 02:42 PM
PM will be alittle harder. There is some info prossesing before. You should copy the whole section and edit where needed.Actually it was pretty easy since I only need the PM sent to the user.

//USERNAME TO PM TO
//$formpmname = "Abe";
$formpmname = $vbulletin->userinfo['username'];
This is great. :banana:

Edit: If user does not have PM checked I get this
Fatal error: Unable to proceed with save while $errors array is not empty in class vb_datamanager_pm in /includes/class_dm.php on line 758

gael11
12-26-2005, 03:38 PM
Hello

I'd like to modify the look of the template:
<template name="formanswers" templatetype="template" date="1133965917" username="Abe" version="3.5.2"><![CDATA[$formtitle
$bbuserinfo[username]

$normalquestion1
$normalanswer1

$radioquestion1
$radioanswer1

$radioquestion2
$radioanswer2

$radioquestion3
$radioanswer3
$radioanswer3other

$question1
$answer1

$question2
$answer2

$question3
$answer3

$dropdownquestion1
$dropdownanswer1

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

$longanswer1

------------------------------------------------------
$vbtextquestion

$vbtextanswer

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

In fact I'd want to make bold the title of the questions for example. The html code seems to not work. How can I modify the look ?
Thanks for your helm ;)

WNxWakko
12-26-2005, 06:08 PM
In fact I'd want to make bold the title of the questions for example. The html code seems to not work. How can I modify the look ?
Thanks for your helm ;)

Very simple. You use VB code. Notice how there is a space before and after the variable. That space is what makes it work. If you dont put the space before and after, it wont work

Bold and Colors are not the actual code, had to change it or the board woudlnt show you it.


$question1
$answer1

gael11
12-26-2005, 08:09 PM
Oh yes I didn't think it was so easy ^^
Thanks for your answer ;)

tommyxv
12-27-2005, 12:33 AM
use $dropdownchoice6aa

Ahh, thx.


You do realize, you dont even need any of that complex coding for a dropdown selector.

Ive been making dropdowns on this form since he first released this.

For example on your form template all you do is this,

<select name="answer3">
<option selected></option>
<option>cows</option>
<option>rabbits</option>
<option>dogs</option>
<option>cats</option>
</select>

Just make sure the name of the dropdown is called answer1, answer2, answer3 and so on.

Damn, i did it the other way. :o

Thanks for the info...

tommyxv
12-27-2005, 02:02 AM
One more question, how can i add a link to the message after they submit the form? And to the message that tells them that they have to fill out eveything since i cannot use quotes??

I have it going to an email right now so i cannot use a redirect.

Thx

Nam
12-27-2005, 04:03 AM
probably the most stupid question, but I can't find any hook/setting to do the form, where is the main hook anybody?


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

bluesteel
12-27-2005, 07:43 AM
ACP >> Plugin Manager >> Look for "Form Hack" >> Edit >> and copy the php plugin code.

HTHs

Datacenter1.com
12-27-2005, 11:12 AM
Great Hack !!!

Just exactly what I was looking for

One question

Is there a way for to add check boxes?

steven s
12-27-2005, 11:18 AM
I finally found the problem. Disabling the sign a contract plugin (https://vborg.vbsupport.ru/showthread.php?t=91867) re-enables your plugin. Since I need this hack more than the contract one, this will work for me for a little while.
This migh be old news but I am using this agreement plugin.
https://vborg.vbsupport.ru/showthread.php?t=97699
A person first has to check that it has been read before the form can be viewed.

Abe1
12-27-2005, 12:05 PM
Great Hack !!!

Just exactly what I was looking for

One question

Is there a way for to add check boxes?

Sure. Edit the template and plug-in. I can't go step by step.

Spinball
12-27-2005, 12:17 PM
Hi Abe and folks,
I appreciate this is a difficult hack to support because everyone will be customising it.
However, the problem that I and someone else are having is very difficult for a non (or indeed semi) skilled coder to fix.
Warning: Cannot use a scalar value as an array in /includes/functions_newpost.php on line 331
It seems that the value of formforum is not being passed from the form to the script for processing.
How is the value supposed to be passed?

Abe1
12-27-2005, 01:21 PM
Hi Abe and folks,
I appreciate this is a difficult hack to support because everyone will be customising it.
However, the problem that I and someone else are having is very difficult for a non (or indeed semi) skilled coder to fix.

It seems that the value of formforum is not being passed from the form to the script for processing.
How is the value supposed to be passed?

Can you post your plug-in here?

Spinball
12-27-2005, 03:50 PM
Can you post your plug-in here?
plug-in:
// 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 = "classifieds_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(
'advert_type' => TYPE_STR,
'advert_title' => TYPE_STR,
'location' => TYPE_STR,
'confirmation' => TYPE_STR
));

// Part 2
$advert_type = $vbulletin->GPC['advert_type'];
$advert_title = $vbulletin->GPC['advert_title'];
$location = $vbulletin->GPC['location'];
$confirmation = $vbulletin->GPC['confirmation'];

////////////////////////////////////////////////////////////////////////////////////////////////////
//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,24,25))) 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_ads";
// 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 = $forumid;

//if (strlen($formforumid) == 0) {
// $errormessage = $vbulletin->userinfo['username'] . ", Fatal Error - please contact admin and tell them the formforumid variable was blank when trying to create a new classified advert. Thanks!";
// eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
// exit();
//}

//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 - 1 = yes, 0 = no
$formpm = "0";

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

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

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

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

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

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

$redirectoption = "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 = "1";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Create a new classified advert";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//PURPOSE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formpurpose = "Please complete all the questions below to create your classified advert.<br>
These adverts are for individuals selling their own personal property only.<br>
Please note that each AV Forums member may have one 'For Sale' and one 'Wanted' advert only.";

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

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

$advert_title_question = "Enter the title of your advert";
$advert_title_explain = "Use the full make & model so that people searching will find your advert.";

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$location_question = "Enter your location";
$location_explain = "State your city and country so that people know where you are located.";

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

$advert_type_question = "Select the type of advert";

// The following choices must NOT have quotation marks
$advert_typea = "For Sale:";
$advert_typeb = "For Trade:";
$advert_typec = "Wanted:";
$advert_type_explain = "This is added to the start of your advert title.";

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

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

$advert_text_question = "Enter the text of your advert.";
$advert_text_explain = "We have some important trading rules for your protection.<br>
Please note the following key points:<br>
1) adverts for hardware may not be listed elsewhere.<br>
2) you must always specify a price and whether it includes delivery.<br>
3) you must not include contact details within your advert since all negotiations should occur in your advert thread.<br>
For an explanation on the above, please refer to the <A HREF=\"http://www.avforums.com/forums/view.php?pg=trading_rules\" target=\"_blank\">trading rules</A> thread.";

////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//VB TICKBOX INPUT: You can only have ONE vb text question. (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$confirmation_question = "Please click the box to agree to the following statement";
$confirmation_explain = "I have read the <A HREF=\"http://www.avforums.com/forums/view.php?pg=trading_rules\" target=\"_blank\">trading rules</A> and agree to abide by them at all times until the transaction is concluded to the satisfaction of all parties involved.";

////////////////////////////////////////////////////////////////////////////////////////////////
////// 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")
{
$vbulletin->input->clean_array_gpc('p', array(
'wysiwyg' => TYPE_BOOL,
'message' => TYPE_STR
));

if ($vbulletin->GPC['wysiwyg'])
{
require_once(DIR . '/includes/functions_wysiwyg.php');
$advert_text_answer = convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $foruminfo['allowhtml']);
}
else
{
$advert_text_answer =& $vbulletin->GPC['message'];
}
if ($answerall == "1")
{
if ($advert_title == '' OR $location == '' OR $advert_text_answer == '' OR $confirmation == '')
{
$errormessage = "$bbuserinfo[username], you need to answer every question!";
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
exit();
}
}

eval('$formsend = "' . fetch_template("$answertemplate") . '";');
if ($formforum == "1")
{
if ($formforumid == 62) {
if ($advert_type == "Wanted:") {
$formforumid = 198;
}
} elseif ($formforumid == 198) {
if ($advert_type == "For Sale:" or $advert_type == "For Trade:") {
$formforumid = 62;
}
}


$foruminfo = verify_id('forum', $formforumid, 0, 1);
$forumperms = fetch_permissions($foruminfo[forumid]);
$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['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") . '");');
}
}
submission form:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle] - $formtitle</title>
</head>
<body>
$header
$navbar

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

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

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

<table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td align="$stylevar[left]">
<fieldset class="fieldset" style="margin:0px">
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td>
$formpurpose
</td>
</tr>
</table>
</fieldset></td>
</tr>
</table></td>
</tr>
<tr>
<td class="alt1" align="right"><b>$advert_type_question</b><br /><select name="advert_type">
<option value="$advert_typea">$advert_typea</option>
<option value="$advert_typeb">$advert_typeb</option>
<option value="$advert_typec">$advert_typec</option>
</select><br /><div class="smallfont">$advert_type_explain</div> </td>
<td colspan="2" class="alt1"><b>$advert_title_question</b><br /><input type="text" size="30" name="advert_title" /><br /><div class="smallfont">$advert_title_explain</div></td>
</tr>
<tr>
<td colspan="3" class="alt2"><b>$advert_text_question</b><br /><div class="smallfont">$advert_text_explain</div><br />
<table cellpadding="0" cellspacing="0" border="0"><tr><td>$messagearea</td></tr></table>
</td>
</tr>
<tr>
<td class="alt1" colspan="3"><b>$location_question</b><br /><input type="text" size="30" name="location" /><br /><div class="smallfont">$location_explain</div></td>
</tr>
<tr>
<td valign="top" class="alt1"><b>$confirmation_question</b></td>
<td class="alt1" colspan="2"><div class="smallfont"><input type="checkbox" name="confirmation" value="Yes"> $confirmation_explain</div></td>
</tr>
<tr>
<td class="alt1" valign="top" colspan="3">
<p align="center">
<input type="submit" value="Submit" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="reset" value="Reset" name="reset" style="font-family: Verdana; font-size: 10pt" class="button" />
</p></td>
</tr>
</table>

</form>

$footer
</body>
</html>
answer form:
$advert_text_answer

Location: $location
I have read and agreed to abide by the AV Forums trading rules : $confirmation.
Thanks, Abe.

Abe1
12-27-2005, 06:40 PM
In the answer template, add a space after $confirmation

Spinball
12-27-2005, 08:09 PM
Thanks Abe, but that didn't make any difference.

Abe1
12-27-2005, 11:55 PM
Thanks Abe, but that didn't make any difference.

Where are you grtting the forumid?

Spinball
12-28-2005, 08:13 AM
Where are you grtting the forumid?
It's being passed from the URL as 'f' as per your instructions in this thread.
http://www.avforums.com/forums/newthread.php?do=classifieds_form&f=62

Abe1
12-28-2005, 12:26 PM
It's being passed from the URL as 'f' as per your instructions in this thread.
http://www.avforums.com/forums/newthread.php?do=classifieds_form&f=62

in the form main template,

find this:<input type="hidden" value="submit" name="action" />add under this:<input type="hidden" value="$forumid" name="f" />

Spinball
12-28-2005, 04:06 PM
Abe, that works!!!!
Thanks very much for your patience and help in sorting this out.
AV Forums members now get a classified advert submission form (with rules agreement tickbox) when creating a thread in in all the classifieds forums.
Using it with your related new thread hack.
May I suggest that you add this useful information into the hack as standard?
Thaks again. Fantastic.

steven s
12-28-2005, 10:54 PM
I'm posting this again.
I'd like to have the form sent to the user as a PM.

//USERNAME TO PM TO
//$formpmname = "Abe";
$formpmname = $vbulletin->userinfo['username'];

Will work unless the person has their PMs OFF. Then I get
Fatal error: Unable to proceed with save while $errors array is not empty in class vb_datamanager_pm in /includes/class_dm.php on line 758

Is there a conditional statement I can use if the person is accepting PMs and not above quota, use $formpm = "1"; and if not $formpm = "0";

pipin
12-29-2005, 07:20 AM
in the form main template,

find this:<input type="hidden" value="submit" name="action" />add under this:<input type="hidden" value="$forumid" name="f" />

thx
used this with threadid and t
and it works now.

but i found a new glitch :speechless:

a posting done through the form wont be shown in the upper category of a subforum as last posting.

https://vborg.vbsupport.ru/external/2006/01/10.jpg

Abe1
12-29-2005, 12:20 PM
thx
used this with threadid and t
and it works now.

but i found a new glitch :speechless:

a posting done through the form wont be shown in the upper category of a subforum as last posting.

https://vborg.vbsupport.ru/external/2006/01/10.jpg

It looks like your camparing it to a category and not another thread.

Abe1
12-29-2005, 12:23 PM
I'm posting this again.
I'd like to have the form sent to the user as a PM.

//USERNAME TO PM TO
//$formpmname = "Abe";
$formpmname = $vbulletin->userinfo['username'];

Will work unless the person has their PMs OFF. Then I get
Fatal error: Unable to proceed with save while $errors array is not empty in class vb_datamanager_pm in /includes/class_dm.php on line 758

Is there a conditional statement I can use if the person is accepting PMs and not above quota, use $formpm = "1"; and if not $formpm = "0";

if ($vbulletin->userinfo['receivepm'])
{
$formpm = "1";
}
else
{
$formpm = "0";
}

Datacenter1.com
12-29-2005, 12:55 PM
Regards

I would like to sent the email to a user group, Does somebody have some code or idea about how to do that?

Thanks

jdebler
12-29-2005, 04:27 PM
Abe:

AWESOME hack...thanks for your outstanding support so far. We will be using this and a small PayPal token of appreciation will be on the way once we get it all working the way we need to.

Is is okay to use javascript in the form? I need to limit the number of charaters in a text area to a specific number. I have the javascript code to use (unless you know of a better way), but I need to know if there are any specific things I should know when implementing it.

Thanks again!

bluesteel
12-29-2005, 04:31 PM
Great hack Abe1. Having some fun with it,but now I'm stuck :(
I don't know if this is possible, but in the answers, can a conditional be set somewhere that show an image depending on what the $radioanswer1 answer is?

ie if radioanswer 1 = Yes, show image 1
else
show image 2

if you know what I mean lol

steven s
12-30-2005, 12:50 AM
if ($vbulletin->userinfo['receivepm'])
{
$formpm = "1";
}
else
{
$formpm = "0";
}Works great! I used that to make a custom thank you based on whether they have their PM on or off also.

Abe1
12-30-2005, 03:02 AM
Abe:

AWESOME hack...thanks for your outstanding support so far. We will be using this and a small PayPal token of appreciation will be on the way once we get it all working the way we need to.

Is is okay to use javascript in the form? I need to limit the number of charaters in a text area to a specific number. I have the javascript code to use (unless you know of a better way), but I need to know if there are any specific things I should know when implementing it.

Thanks again!

Should be no problem.

Abe1
12-30-2005, 03:03 AM
Great hack Abe1. Having some fun with it,but now I'm stuck :(
I don't know if this is possible, but in the answers, can a conditional be set somewhere that show an image depending on what the $radioanswer1 answer is?

ie if radioanswer 1 = Yes, show image 1
else
show image 2

if you know what I mean lol

Yes, it's possable.

forum-il
12-30-2005, 03:37 AM
how do i do that the form will be sent to my e-mail addres?

Bacon Butty
12-30-2005, 10:30 AM
Can anyone tell me how on earth I can edit the questions on the default form?

"edit the main hook"... ok, i got that bit... shame i dont know were the "hook" is??

Abe1
12-30-2005, 12:01 PM
Can anyone tell me how on earth I can edit the questions on the default form?

"edit the main hook"... ok, i got that bit... shame i dont know were the "hook" is??

HOOK, AKA PLUGIN

forum-il
12-30-2005, 01:03 PM
how do i do that the form will be sent to my e-mail addres?

bluesteel
12-30-2005, 05:45 PM
Yes, it's possable.

Thanks Abe1!
Any hints?
Pretty please :)

steven s
12-31-2005, 12:19 AM
how do i do that the form will be sent to my e-mail addres?
//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "email@yourdomain.com";

steven s
12-31-2005, 12:20 AM
Can anyone tell me how on earth I can edit the questions on the default form?

"edit the main hook"... ok, i got that bit... shame i dont know were the "hook" is??Edit your form template. It is nothing more than html.

Bluestrike2
12-31-2005, 06:21 PM
Cool Hack - but I have a problem - I get this parse error :(

Parse error: parse error, unexpected T_STRING in /hsphere/local/home/bluestri/mlgpwncast.com/newthread.php(68) : eval()'d code on line 133


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

// Name of this form
$formname = "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,
'radioanswer1' => TYPE_STR,
'radioanswer2' => TYPE_STR,
'radioanswer3' => TYPE_STR,
'radioanswer3other' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'longanswer1' => TYPE_STR
));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

$redirectoption = "0";

$Thank you for submiting your video to the MLG PwnCast Hosting Review System, or PHRS. Because of the immense number of requests the PHRS receives daily we are unable to give you a proper timeframe as to when you will be notified
(via PM) as to whether or not your video was approved (and subsequently chosen by one of our hosting network partners). Please keep in mind that if you contact the PHRS, or any of its reviewers, during the process that your video
will take longer. Thank you!"; //This is the thank you message

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

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

$answerall = "0";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Request - PwnCast Hosting Review System";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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] - PHRS Submission";

////////////////////////////////////////////////////////////////////////////////////////////////////
//PURPOSE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

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

$normalquestion1 = "Video Title";

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

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

$radioquestion1 = "Have you received previous critiques on your video?";

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

$radioquestion2 = "Is the audio of high quality?";

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

$radioquestion3 = "Is the video of high quality?";

// 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)
$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)
$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)
$question3 = "What is the temporary URL to your video??";
$explain3 = "We recommend using YouHostIt.com";

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

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

$dropdownquestion1 = "What kind of video is this?";

// The following choices must NOT have quotation marks
$dropdownchoice1a = "Montage";
$dropdownchoice1b = "Gameplay";
$dropdownchoice1c = "Misc./Other";

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

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

$longquestion1 = "Video Description";
$longexplain1 = "";

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

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

$vbtextquestion = "Do you have any other questions/comments/concerns?";
$vbtextexplain = "";

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

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

I appreciate any help you can give me - more than anything you could imagine :D.

jesse
12-31-2005, 09:33 PM
want to be able to manage a file like upload a image or a word file etc.

silly rabbit
12-31-2005, 09:40 PM
So anyone have any idea I might be getting "Sorry! This forum is not accepting new posts." when the forum in question has no posting restrictions whatsoever?
Sorry to keep bumping this. Still wondering if there is anything else I should look at here.

I am reading this for the 1'st time and as I go I suspect the forum you are posting to doesn't allow 'attachments'!!!!

Rabbit

Abe1
12-31-2005, 10:31 PM
Cool Hack - but I have a problem - I get this parse error :(

Parse error: parse error, unexpected T_STRING in /hsphere/local/home/bluestri/mlgpwncast.com/newthread.php(68) : eval()'d code on line 133


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

// Name of this form
$formname = "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,
'radioanswer1' => TYPE_STR,
'radioanswer2' => TYPE_STR,
'radioanswer3' => TYPE_STR,
'radioanswer3other' => TYPE_STR,
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'longanswer1' => TYPE_STR
));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

$redirectoption = "0";

$Thank you for submiting your video to the MLG PwnCast Hosting Review System, or PHRS. Because of the immense number of requests the PHRS receives daily we are unable to give you a proper timeframe as to when you will be notified
(via PM) as to whether or not your video was approved (and subsequently chosen by one of our hosting network partners). Please keep in mind that if you contact the PHRS, or any of its reviewers, during the process that your video
will take longer. Thank you!"; //This is the thank you message

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

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

$answerall = "0";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Request - PwnCast Hosting Review System";

////////////////////////////////////////////////////////////////////////////////////////////////////
//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] - PHRS Submission";

////////////////////////////////////////////////////////////////////////////////////////////////////
//PURPOSE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

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

$normalquestion1 = "Video Title";

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

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

$radioquestion1 = "Have you received previous critiques on your video?";

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

$radioquestion2 = "Is the audio of high quality?";

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

$radioquestion3 = "Is the video of high quality?";

// 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)
$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)
$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)
$question3 = "What is the temporary URL to your video??";
$explain3 = "We recommend using YouHostIt.com";

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

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

$dropdownquestion1 = "What kind of video is this?";

// The following choices must NOT have quotation marks
$dropdownchoice1a = "Montage";
$dropdownchoice1b = "Gameplay";
$dropdownchoice1c = "Misc./Other";

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

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

$longquestion1 = "Video Description";
$longexplain1 = "";

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

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

$vbtextquestion = "Do you have any other questions/comments/concerns?";
$vbtextexplain = "";

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

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

I appreciate any help you can give me - more than anything you could imagine :D.

The thank you message is not in quotes.

ChrisBaktis
01-01-2006, 12:17 AM
I have a form set to post as a thread - im trying to have the members name (member that is filling out the form) appear in the title of the thread that is posted. However when I put $bbuserinfo[username] in the $posttitle field it doesnt show...any suggestions?

Abe1
01-01-2006, 05:25 AM
I have a form set to post as a thread - im trying to have the members name (member that is filling out the form) appear in the title of the thread that is posted. However when I put $bbuserinfo[username] in the $posttitle field it doesnt show...any suggestions?

use $vbulletin->userinfo[username]

ChrisBaktis
01-01-2006, 01:45 PM
this is the code I used:

$vbulletin->userinfo[username] / $normalanswer1

This is the result

Array[username] / bruins

bruins is the $normalanswer 1 so that works fine.

Abe1
01-01-2006, 01:57 PM
this is the code I used:

$vbulletin->userinfo[username] / $normalanswer1

This is the result

Array[username] / bruins

bruins is the $normalanswer 1 so that works fine.

add to the line before,
$bbuserinfo = $vbulletin->userifo;
now, you can use $bbuserinfo[usergroup]

ChrisBaktis
01-01-2006, 02:39 PM
sorry about being a noob but you have me lost on this...

$bbuserinfo = $vbulletin->userinfo; <<-- is already in the main script area of the form

but in your last post you are now saying use $bbuserinfo[usergroup] and Im not sure why....

This is the code I have tried and the result:

$bbuserinfo <<---- results in a blank post title

$vbulletin->userinfo <<-- results in Array[username]

your post was confusing as what to add and to where.

Abe1
01-01-2006, 06:21 PM
sorry about being a noob but you have me lost on this...

$bbuserinfo = $vbulletin->userinfo; <<-- is already in the main script area of the form

but in your last post you are now saying use $bbuserinfo[usergroup] and Im not sure why....

This is the code I have tried and the result:

$bbuserinfo <<---- results in a blank post title

$vbulletin->userinfo <<-- results in Array[username]

your post was confusing as what to add and to where.

Use $bbuserinfo[username] but on the line right above add this: $bbuserinfo = $vbulletin->userinfo;

ChrisBaktis
01-01-2006, 09:28 PM
Thank you

futuregizmo
01-01-2006, 10:40 PM
noob question, would this work with ver 3.5.0 or would i need to upgrade to 3.5.2 to use this hack?

steven s
01-01-2006, 10:51 PM
noob question, would this work with ver 3.5.0 or would i need to upgrade to 3.5.2 to use this hack?Redundant question as you should update to 3.5.2 regardless. ;)

Abe1
01-01-2006, 11:28 PM
noob question, would this work with ver 3.5.0 or would i need to upgrade to 3.5.2 to use this hack?

yes, It should work with 3.5.0

futuregizmo
01-02-2006, 12:18 AM
Redundant question as you should update to 3.5.2 regardless. ;)

naah, not thinking of doing so yet, since some hacks installed in my site are not compatible with 3.5.2 and i can't afford to lose them. ;)

Oreamnos
01-02-2006, 12:34 AM
great looking plugin.

one question: is it possible to insert the form submitted by the user into a specific forum DEPENDING on what drop down box option is selected?

Example:
1. I have 3 forums: Canada, America & Mexico

2. The user selects 'America' from the drop down box.

3. The user's post is posted in the 'America' forum.

I hope that make sense.

Is this possible?

Thanks
eric

rip9001
01-02-2006, 04:48 AM
hey, installed it works great

1 question: What do i have to do to get this form to come up when sombody tries to create a new thread in a certain section (eg. forumid: 55)

I had a look through both forumdisplay.php and newthread.php but im still kind of a newb at this

Oreamnos
01-02-2006, 05:02 AM
You might have to create a new style and then change the link to newthread.php to something like this: forum/newthread.php?do=newthread&f=55&do=form

Nikke
01-02-2006, 11:16 AM
How do I create double templates for two different types of forms? I did manage to do the plugin part where you had to copy the plugin, but how will I get two different templates?

ChrisBaktis
01-02-2006, 12:47 PM
hey, installed it works great

1 question: What do i have to do to get this form to come up when sombody tries to create a new thread in a certain section (eg. forumid: 55)

I had a look through both forumdisplay.php and newthread.php but im still kind of a newb at this

I do this on my site.....you will need to change to locations in the FORUMDISPLAY template....

This appears in two spots....im nost sure on your style but you will see what I have changed and you should be able to find it in your template...

<td class="smallfont"><if condition="$show['newthreadlink'] and $foruminfo[forumid] <> '36'"><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 /><a href="http://rustysoaptraders.com/forums/newthread.php?do=tradeform"><font size="2">Post A Trade</font></a></if></td>

What this code above does is leave the 'New Thread' link in all the forums except my forum number 36...if it is forum 36 then 'Post A Trade' link shows up and when that is clicked it goes to my form.

Make sure you keep a copy of the original template in case you make an error. Hope this helps.

*** of course I didnt see the Add-On that may do this same thing.

Abe1
01-02-2006, 12:48 PM
hey, installed it works great

1 question: What do i have to do to get this form to come up when sombody tries to create a new thread in a certain section (eg. forumid: 55)

I had a look through both forumdisplay.php and newthread.php but im still kind of a newb at this

Hack has been made already. Look at the add-ons to this hack.

Abe1
01-02-2006, 12:49 PM
great looking plugin.

one question: is it possible to insert the form submitted by the user into a specific forum DEPENDING on what drop down box option is selected?

Example:
1. I have 3 forums: Canada, America & Mexico

2. The user selects 'America' from the drop down box.

3. The user's post is posted in the 'America' forum.

I hope that make sense.

Is this possible?

Thanks
eric

Yes, it's possable. No, I dont have to time to write it right now. Something to do with the values of a drop down menu.

HaMaDa4eVeR
01-02-2006, 04:03 PM
Hello
I got this error message :
Parse error: parse error, unexpected T_STRING in /home/xXx/public_html/vb/newthread.php(68) : eval()'d code on line 3

and when I try to open newthread.php?do=form I will get this error

Invalid forum specified. If you followed a valid link, please notify the administrator

althouth everything is right and I changed the formforumid to the my specified forum id ?????

wrang
01-02-2006, 04:14 PM
Is it possible to have a attachment in this form hack. if so how do i do

HaMaDa4eVeR
01-02-2006, 04:20 PM
Hello
I got this error message when i do new post :

Parse error: parse error, unexpected T_STRING in


and when I try to open newthread.php?do=form I will get this error

Invalid forum specified. If you followed a valid link, please notify the administrator


althouth everything is right and I changed the formforumid to the my specified forum id ?????

sully02
01-02-2006, 05:08 PM
I am getting a similar error, except mine is a T_CONSTANT_ENCAPSED_STRING, and it's on line 29 instead of line 3.

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/sportsd/public_html/forums/newthread.php(68) : eval()'d code on line 29

I didn't make any PHP code edits, so I'm trying to figure out exactly where I messed up.

steven s
01-02-2006, 05:55 PM
Everytime I get that error has been because of my hacking.
Third line?
// Name of this form
$formname = "form"; <-- do you have the semicolon?

Puntoboy
01-02-2006, 06:05 PM
am i missing something here??

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

i went into Edit, then then there isn't much info there. a few blank boxes and thats it.

steven s
01-02-2006, 06:14 PM
am i missing something here??

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

i went into Edit, then then there isn't much info there. a few blank boxes and thats it.Hook Location : newthread_start

Puntoboy
01-02-2006, 06:16 PM
Hook Location : newthread_start

where is that?

steven s
01-02-2006, 06:28 PM
where is that?
ACP->Plugin System->Plugin Manager->Hook Location : newthread_start->Form Hack

Puntoboy
01-02-2006, 06:49 PM
thanks, this is quite difficult to edit.

Puntoboy
01-02-2006, 06:53 PM
thanks, this is quite difficult to edit.

i cant get it to edit

http://www.puntosports.co.uk/forums/newthread.php?do=Application

Puntoboy
01-02-2006, 07:00 PM
i cant get it to edit

http://www.puntosports.co.uk/forums/newthread.php?do=Application

it says do not use quotation marks, but there are already quotation marks in every option.

i've added 7 normal questions but only one shows. followed by questions that i deleted from the original template.

rip9001
01-02-2006, 07:29 PM
Got it to Work. Great Hack!.

Thanks Abe

Puntoboy
01-02-2006, 07:41 PM
can anyone help me?

rnmcd
01-02-2006, 07:43 PM
Very awesome!!!

Totally agree with Jugo, I think I have 8 or 9 forms running on my site now :)

Thanks!

Very nice. Lots of great uses.

sully02
01-02-2006, 08:01 PM
can anyone help me?

It's a bit confusing. What he means by that is, don't add any quotation marks to your questions.

If you have a question, it would be stored as "This is a question right here" in the product

However, if you add quotation marks to that, you'd get something like "This is a "question" right here" resulting in a parse error because of the added quotation marks.

Puntoboy
01-02-2006, 08:07 PM
It's a bit confusing. What he means by that is, don't add any quotation marks to your questions.

If you have a question, it would be stored as "This is a question right here" in the product

However, if you add quotation marks to that, you'd get something like "This is a "question" right here" resulting in a parse error because of the added quotation marks.

ok thats fine.

however i can't even get the questions to display right. click the link i posted to see what i mean.

i delelted the un needed parts of the default form but the questions i added wont display, only the first one does.

sully02
01-02-2006, 08:20 PM
ok thats fine.

however i can't even get the questions to display right. click the link i posted to see what i mean.

i delelted the un needed parts of the default form but the questions i added wont display, only the first one does.

I can't say for sure, but I think you may have inadvertently deleted the stored questions, explanations, and choices. I didn't care for editing via the hook, so when I got the product, I edited the XML file and uploaded it.

If you do that, go down to where it says "CUSTOMIZE VARIABLES". At that point you should see a list of questions/explanations/choices. Edit those to fit the form contents you need and you should be set!

Puntoboy
01-02-2006, 08:22 PM
i tried that, but in the hook edit section....

sully02
01-02-2006, 08:24 PM
i tried that, but in the hook edit section....

In that case, I'm not sure... I assume you didn't edit any of the templates, right?

Puntoboy
01-02-2006, 08:31 PM
here is what i have

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

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

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

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

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

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

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

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

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

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

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

// Name of the main template
$maintemplate = "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
$formpmname = "Abe";

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

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

//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "club@puntosports.co.uk";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 this form!"; //This is the thank you message

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

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

$answerall = "1";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Club Member Application 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 = "If you wish to become a member of The Punto Sports Club, please fill in this form.";

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

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

$normalquestion1 = "Title (Mr, Mrs, Miss etc.)";

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

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

$normalquestion1 = "First Name";

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

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

$normalquestion1 = "Surname";

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

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

$normalquestion1 = "Address";

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

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

$normalquestion1 = "Town";

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

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

$normalquestion1 = "County";

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

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

$normalquestion1 = "Post Code";

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

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

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

sully02
01-02-2006, 08:56 PM
Figured it out. You changed the questions to fit what you need, but you didn't edit the template to accomodate that. In addition, you also need to change the variables to reflect the questions you are asking.

You'll need to change all of your $normalquestion1 variables to $normalquestion1, $normalquestion2, etc. because if you don't, you'll just overwrite what's on the variable and only the last item (Post code) will show up. Go through all of your questions and replace them accordingly.

After that, go to your variables and replace the variables with what I've put below:
// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'normalanswer1' => TYPE_STR,
'normalanswer2' => TYPE_STR,
'normalanswer3' => TYPE_STR,
'normalanswer4' => TYPE_STR,
'normalanswer5' => TYPE_STR,
'normalanswer6' => TYPE_STR,
'normalanswer7' => TYPE_STR,
));

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


After you've done that, edit the templates at the top of the file. Edit the form to display all of your normal answers, then edit the formanswers template to display all of your answers.

Puntoboy
01-02-2006, 08:58 PM
ok cheers, i'll give that a go.

got loads of stuff to do!

Puntoboy
01-02-2006, 09:04 PM
like this??

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

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,
'normalanswer4' => TYPE_STR,
'normalanswer5' => TYPE_STR,
'normalanswer6' => TYPE_STR,
'normalanswer7' => TYPE_STR,
));

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

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

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

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

//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "club@puntosports.co.uk";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 this form!"; //This is the thank you message

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

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

$answerall = "1";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Club Member Application 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 = "If you wish to become a member of The Punto Sports Club, please fill in this form.";

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

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

$normalquestion1 = "Title (Mr, Mrs, Miss etc.)";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 2 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion2 = "First Name";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 3 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion3 = "Surname";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 4 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion4 = "Address";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 5 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion5 = "Town";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 6 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion6 = "County";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 7 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion7 = "Post Code";

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

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

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

also, how do i add the username field?

sully02
01-02-2006, 09:08 PM
like this??

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

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,
'normalanswer4' => TYPE_STR,
'normalanswer5' => TYPE_STR,
'normalanswer6' => TYPE_STR,
'normalanswer7' => TYPE_STR,
));

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

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

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

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

//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "club@puntosports.co.uk";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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 this form!"; //This is the thank you message

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

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

$answerall = "1";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle = "Club Member Application 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 = "If you wish to become a member of The Punto Sports Club, please fill in this form.";

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

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

$normalquestion1 = "Title (Mr, Mrs, Miss etc.)";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 2 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion2 = "First Name";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 3 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion3 = "Surname";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 4 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion4 = "Address";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 5 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion5 = "Town";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 6 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion6 = "County";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 7 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion7 = "Post Code";

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

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

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


$bbuserinfo = $vbulletin->userinfo;

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

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

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

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

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

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

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

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

also, how do i add the username field?

You got it for the bottom, now you just need to edit the templates at the top of the page.

As far as the username field, it is already on there (both templates). If you're looking to put it in the title of whatever form you are making, replace the part under "Title of form" with the following:

$bbuserinfo = $vbulletin->userinfo;
$formtitle = "Whatever your form's name is with your user's name right here $bbuserinfo[username]";

Puntoboy
01-02-2006, 09:16 PM
edit the templates? i thought i did that. i copied what you posted.

sully02
01-02-2006, 09:23 PM
edit the templates? i thought i did that. i copied what you posted.

You changed the variables, but at the top of the XML file there are two templates. You'll need to edit those to fit what you need for your forums. If you'd like, I can take a look at your XML file and try to fix those templates up so you can use your form.

Puntoboy
01-02-2006, 09:28 PM
ah so its in the xml file and not here in this code?

sully02
01-02-2006, 11:00 PM
ah so its in the xml file and not here in this code?

It's not reachable if you edit via the plugin manager. I just finished some serious modification to the templates for my form, so it is possible to make it work deviating from the current lineup of questions:

http://sports-boards.net/forums/newthread.php?do=lmdapp

To do so requires at least some HTML knowledge, so if you don't feel comfortable with it, I can take a look at what you've got and work with it to make it look sorta decent.

steven s
01-02-2006, 11:00 PM
ah so its in the xml file and not here in this code?
No, the templates are in the Style & Templates section. The original templates are named form and formanswers.

sully02
01-02-2006, 11:05 PM
No, the templates are in the Style & Templates section. The original templates are named form and formanswers.

Correct. I just never bothered to look there. I edited directly from the XML file and imported with an overwrite. That said, either option would work (XML or Styles & Templates).

Puntoboy
01-02-2006, 11:06 PM
thats brilliant.

basically the forum i'm trying to create is a membership application form for the club.

i need these fields:

Title (Mr, Mrs, Miss, Ms etc.)
First Name
Surname
Address
Town
County
Post Code
Country
Date of Birth
Daytime Tel.
Evening Tel.
Mobile Tel.
E-mail
Punto mark
Model
Year
Registration
Colour
Payment Method (which needs to be Paypal, Cash, Cheque, Postal Order, Other... Please Specifiy)

and thats it.

all pretty straight forward except the last one.

sully02
01-02-2006, 11:09 PM
thats brilliant.

basically the forum i'm trying to create is a membership application form for the club.

i need these fields:

Title (Mr, Mrs, Miss, Ms etc.)
First Name
Surname
Address
Town
County
Post Code
Country
Date of Birth
Daytime Tel.
Evening Tel.
Mobile Tel.
E-mail
Punto mark
Model
Year
Registration
Colour
Payment Method (which needs to be Paypal, Cash, Cheque, Postal Order, Other... Please Specifiy)

and thats it.

all pretty straight forward except the last one.

Sounds good. If you'd like, I can scrape something semi-decent together for you.

Puntoboy
01-02-2006, 11:12 PM
that would be great.

at least then i can see everything i need to do for next time.