vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   New Posting Features - Form Hack (https://vborg.vbsupport.ru/showthread.php?t=126676)

Deepdog009 04-11-2007 11:45 AM

Quote:

Originally Posted by rayw (Post 1224763)
I'm trying to modify this form a little bit so that I have a drop down box with a list of 2-3 forums that users can choose to post the information too. I'm not an experienced programmer so I'm having a little trouble getting this working.

Would anyone be willing to post exactly what needs to be modified for this to work correctly?

THanks! :)


Next goto MAIN Template and adddddddd that new dropdown there also...>>>
Use your own code or template code to add...
3 dropdowns below in code

HTML Code:

<TABLE width="100%"><TR>
  <TD class="radio_button_question question" colspan="4">
<B>* </B>
$dropdownquestion4
</TD>
</TR>
<TR><TD class="radio_button_answer" ><table cellspacing="0" cellpadding="0"><tr><td class="radio_button_answer">
<!--DROP_DOWN_TYPE --><select name="dropdownanswer4" class="radio_button">
<option value="$dropdownchoice4a" <if condition="$dropdownchoice4a == $dropdownanswer4">selected="selected"</if>>$dropdownchoice4a</option>
<option value="$dropdownchoice4b" <if condition="$dropdownchoice3b == $dropdownanswer4">selected="selected"</if>>$dropdownchoice4b</option>
<option value="$dropdownchoice4c" <if condition="$dropdownchoice4c == $dropdownanswer4">selected="selected"</if>>$dropdownchoice4c</option>
</SELECT>
</td></tr></table></TD></TR></TABLE>
<p></p>
<div align="center">
<tr>
<td class="alt2" valign="middle" colspan="3">
<b>$vbtextquestion</b><br />
$vbtextexplain
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
$messagearea
</td>
</tr>
</table>
</div>
</td>
</tr>
<if condition="$attachmentoption">
<tr>
<td class="alt1" colspan="3" align="center">
<div style="width:$stylevar[formwidth]" align="$stylevar[left]">$attachmentoption</div>
</td>
</tr>
</if>
<tr>
<td valign="top" colspan="3">
<p align="center">
<input type="submit" value="Submit" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="submit" value="Preview" name="submit" style="font-family: Verdana; font-size: 10pt" class="button" />
<input type="reset" value="Reset" name="reset" style="font-family: Verdana; font-size: 10pt" class="button" />
</p></td></tr>
</table>

</form>

$footer
</body>
</html>


Deepdog009 04-11-2007 11:50 AM

Quote:

Originally Posted by rayw (Post 1224763)
I'm trying to modify this form a little bit so that I have a drop down box with a list of 2-3 forums that users can choose to post the information too. I'm not an experienced programmer so I'm having a little trouble getting this working.

Would anyone be willing to post exactly what needs to be modified for this to work correctly?

THanks! :)

Add to plugin code with NEW dropdown...
Add to proper location...
'dropdownanswer4' => TYPE_STR,
$dropdownanswer4 = $vbulletin->GPC['dropdownanswer4];


HTML Code:

// Part 1
$vbulletin->input->clean_array_gpc('p', array(
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'radioanswer1' => TYPE_STR,
'radioanswer2' => TYPE_STR,
'radioanswer3' => TYPE_STR,
'radioanswer4' => TYPE_STR,
'radioanswer5' => TYPE_STR,
'radioanswer6' => TYPE_STR,
'radioanswer7' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'dropdownanswer2' => TYPE_STR,
'answer3' => TYPE_STR,
'radioanswer8' => TYPE_STR,
'radioanswer9' => TYPE_STR,
'radioanswer10' => TYPE_STR,
'radioanswer11' => TYPE_STR,
'answer4' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'answer5' => TYPE_STR,
'answer6' => TYPE_STR,
));

// Part 2
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$radioanswer2 = $vbulletin->GPC['radioanswer2'];
$radioanswer3 = $vbulletin->GPC['radioanswer3'];
$radioanswer4 = $vbulletin->GPC['radioanswer4'];
$radioanswer5 = $vbulletin->GPC['radioanswer5'];
$radioanswer6 = $vbulletin->GPC['radioanswer6'];
$radioanswer7 = $vbulletin->GPC['radioanswer7'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$dropdownanswer2 = $vbulletin->GPC['dropdownanswer2'];
$answer3 = $vbulletin->GPC['answer3'];
$radioanswer8 = $vbulletin->GPC['radioanswer8'];
$radioanswer9 = $vbulletin->GPC['radioanswer9'];
$radioanswer10 = $vbulletin->GPC['radioanswer10'];
$radioanswer11 = $vbulletin->GPC['radioanswer11'];
$answer4 = $vbulletin->GPC['answer4'];
$dropdownanswer3 = $vbulletin->GPC['dropdownanswer3'];
$answer5 = $vbulletin->GPC['answer5'];
$answer6 = $vbulletin->GPC['answer6'];


Lower Plugin code area...> questions...>

HTML Code:

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

$dropdownquestion4 = "Which forum to post to question here...<<<";

// The following choices must NOT have quotation marks
$dropdownchoice4a = "MLB";
$dropdownchoice4b = "NFL";
$dropdownchoice4c = "NBA";

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


Good Luck;)

rayw 04-11-2007 12:23 PM

Thanks a lot for taking the time to explain that Deepdog009, but I don't think it answers my question (if it does, then I don't understand it).

For example, say you wanted a form to post news in your forum. There are 3 different forums which represent the catergories the for news. They are Sport, Weather and Other - each of which are different forums.

Basically, depending on what you select in the drop down box will determine which forum the news is posted in to.

I hope that makes more sense.

:)

Deepdog009 04-12-2007 02:03 AM

RayW what you be asking requires some code modifications. Im good with CSS and HTML but at this time Im still reading and learning on PHP, Perl and Java.

ABE1 can help you better.

Take a peek in the earlier posts and maybe theres something there that might help U.

Good Luck

rayw 04-12-2007 05:26 AM

No worries, thanks a lot.

Cheers! :)

rayw 04-12-2007 07:29 AM

Ok, I've been trying to nut this out based on what others have posted in the thread.

Basically, I want a drop down box which defines what forum the news will be posted too.

I have the following:

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.

if ($dropdownanswer1 == 'Hardware'){
$formforumid = "96";}
if ($dropdownanswer1 == 'Software'){
$formforumid = "99";}

Further down:
Code:

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

// The following choices must NOT have quotation marks

$newscatchoice1a = "Hardware";
$newscatchoice1b = "Software";

Template:
Code:

<select name="dropdownanswer1">
<option value="$newscatchoice1a" <if condition="$newscatchoice1a == $dropdownanswer1">selected="selected"</if>>$newscatchoice1a</option>
<option value="$newscatchoice1b" <if condition="$newscatchoice1b == $dropdownanswer1">selected="selected"</if>>$newscatchoice1b</option>
</select>

EDIT - THIS IS FIXED - SEE POST BELOW: When I submit the form using this, I get: Warning: Cannot use a scalar value as an array in /includes/functions_newpost.php on line 356

Could someone offer some advice. I'm assuming the problem lies in the above somewhere; maybe!! :confused:

THanks!

rayw 04-12-2007 07:35 AM

HEY!!!! I figured it out. I just noticed that <select name="dropdownforum1"> should be <select name="dropdownanswer1">.

I will post the finished product once I have fine tuned it. :)

EDIT: I've updated the code above so it should work fine now.

Deepdog009 04-12-2007 11:34 AM

U da Man RayW:up:

Yes please post your outcome when finished.

If statements seem easy until you place them. But eventually hard work and patience will prevail.

Cya :)

VHLinks 04-15-2007 06:55 AM

Hey guys, maybe I missed it, I also ran a search. Is there way to set this up so you can select a post icon, and not have it be blank when it posts the topic? I was trying to figure out a way to do it, but I kept breaking the code. Any ideas would be great. Thanks!

upnorth 04-16-2007 04:04 PM

I'm looking for some guidance in formatting the answer template so that I can control the way the finished post looks. Is there any way to use conditionals in the answer template?

For example I have

$question1
$checkboxAnswer1_1
$checkboxAnswer1_2
$checkboxAnswer1_3

If only the first checkbox is selected on the form then the $checkboxAnswer1_2 and $checkboxAnswer1_3 put spaces in the final post. I'd like to do something like

if ($checkboxAnswer1_2==""){
echo "";
}
That way I can eliminate the spaces?

Any ideas?

MoB Dudditz MD 04-17-2007 03:18 AM

As with any area that allows for user input, does this hack validate input in any way?
I just want to make sure it is secure enough so that the average user cannot exploit it.
If not, is there a way to integrate validation to make it more secure?
Thanks

TheMilkCarton 04-17-2007 03:41 AM

You can use some JavaScript and expressions to limit input in any of the boxes. I've done this so that a certain box can only have numbers input into it. You could essentially use this as a NoSpam! type mod. Then you can modify your form plugin so that ALL the fields must be answered.

Or you can wait until I finalize my Image Verification add-on... which is looking pretty dismal right now. :( I just don't have time to test every little thing, and I certainly won't support it when/if I do release it.

I may see if Abe1 would like to take what I've done and test it and incorporate it right into the actual form hack. Not sure if he's interested though.

Limerick 04-17-2007 04:12 PM

Quote:

Originally Posted by rayw (Post 1225722)

I will post the finished product once I have fine tuned it. :)

Hello rayw,

Did you succeed?
I'm interested by your search ;)

Deepdog009 04-17-2007 07:17 PM

Thanks 2 ABE1 file I have inserted IMAGE VERIFICATION...

I have created two forms of IMAGE VERIFICATION 2 use with this HACK...

check my sig for more info...

Good Luck...;)

Thanks again 4 dis Hack ABE1 im learning about forms.

Deepdog009 04-17-2007 07:22 PM

Quote:

Originally Posted by upnorth (Post 1229057)
I'm looking for some guidance in formatting the answer template so that I can control the way the finished post looks. Is there any way to use conditionals in the answer template?

For example I have

$question1
$checkboxAnswer1_1
$checkboxAnswer1_2
$checkboxAnswer1_3

If only the first checkbox is selected on the form then the $checkboxAnswer1_2 and $checkboxAnswer1_3 put spaces in the final post. I'd like to do something like

if ($checkboxAnswer1_2==""){
echo "";
}
That way I can eliminate the spaces?

Any ideas?

UpNorth this can be done, but you will have to alter the plugin file to match and execute.

I still learning this stuff, Im sure ABE1 can do this with his eyes closed, but hes a busy man.
I will take a look and see if I can help...

Check with RayW, he has made some progress in this area...

Limerick 04-17-2007 07:37 PM

Hello All,

In fact I wish to know if it is possible to let people post the form in any of the existing forums. To do so, they should be able to select the forum in a dropdown list looking like the "Forum Jump" list.

Would this be possible?

And first off all, would it also possible to let users choose the name of the filled form when posted?
For example the form type would be displayed like a prefix and the user would complete this prefix by a name written in a mandatory field...

Thanks for your help :)

Mookie 04-18-2007 02:10 AM

I am having a problem with the form hack. I am receiving a error

Code:

Invalid Forum specified. If you followed a valid link, please notify the administrator
Does anyone know how to fix this error. I have tried almost everything... I guess there is something that I have not tried yet.

rayw 04-18-2007 02:43 AM

Quote:

Originally Posted by Limerick (Post 1229941)
Hello All,

In fact I wish to know if it is possible to let people post the form in any of the existing forums. To do so, they should be able to select the forum in a dropdown list looking like the "Forum Jump" list.

Would this be possible?

The answer to this is above. (well, it is back on the last page now about half way down).

It is exactly what I've got running on my forums at the moment, only with a few extra forums added.

rayw 04-18-2007 03:02 AM

Quote:

Originally Posted by upnorth (Post 1229057)
I'm looking for some guidance in formatting the answer template so that I can control the way the finished post looks. Is there any way to use conditionals in the answer template?

For example I have

$question1
$checkboxAnswer1_1
$checkboxAnswer1_2
$checkboxAnswer1_3

If only the first checkbox is selected on the form then the $checkboxAnswer1_2 and $checkboxAnswer1_3 put spaces in the final post. I'd like to do something like

if ($checkboxAnswer1_2==""){
echo "";
}
That way I can eliminate the spaces?

Any ideas?


Quote:

Originally Posted by Deepdog009 (Post 1229919)
Check with RayW, he has made some progress in this area...

upnorth, I'm no experienced programmer (I'm still learning too) but it looks like you have the right idea.

You may be able to work it out using what I have posted here (it is back on the previous page about half way down as well). If you give your checkboxes values ($checkbox1a, $checkbox1b, $checkbox1c, for example) and apply those values to what I have written, you would be pretty close to fixing your problem I reckon. You may need to make 1 or two other tiny changes to make it function correctly.

I wish I could help more! :)

Limerick 04-18-2007 05:42 AM

Quote:

Originally Posted by rayw (Post 1230163)
The answer to this is above. (well, it is back on the last page now about half way down).

It is exactly what I've got running on my forums at the moment, only with a few extra forums added.


Hello rayw,

Thanks for your answer, but when you say
Quote:

I will post the finished product once I have fine tuned it.
, I thought it was not finished. Especially when you say
Quote:

When I submit the form using this, I get: Warning: Cannot use a scalar value as an array in /includes/functions_newpost.php on line 356

Could someone offer some advice. I'm assuming the problem lies in the above somewhere; maybe!!
.

But your answer here should mean "all is ok now", I guess :)

rayw 04-18-2007 05:50 AM

I posted a message directly below the one with code in it stating that the problem had been fixed. I've also updated the code so yes, everything should work fine now. It wasn't very clear though, sorry. :(

Limerick 04-18-2007 06:32 AM

No, no rayw, don't be sorry, I may have read all this to fast.
Anyway, thank you very much for your work and help
I'll give a try to it this evening :)

Limerick 04-18-2007 07:10 PM

Well, rayw... I've a slight change to do.
In fact, I have a lot of forums and su-forums. All these may change time to time, so I would need this tweak to be easy to manage.

My idea would be to use the forumjump template to improve that product.

Something like this, where when clicked on, would post the thread in :

PHP Code:

<div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">
    <
form action="forumdisplay.php" method="get">
    <
input type="hidden" name="s" value="$session[sessionhash]/>
    <
input type="hidden" name="daysprune" value="$daysprune/>
    <
strong>$vbphrase[forum_jump]</strong><br />
    <
select name="f" onchange="this.form.submit();">
        <
optgroup label="$vbphrase[forums]">
        
$jumpforumbits
        
</optgroup>
    </
select>$gobutton
    
</form>
</
div

Would it be possible to have this?

j_86 04-18-2007 07:44 PM

How do you send an e-mail out to a group with the contents of the form?

rayw 04-18-2007 10:35 PM

Quote:

Originally Posted by Limerick (Post 1230684)
Well, rayw... I've a slight change to do.
In fact, I have a lot of forums and su-forums. All these may change time to time, so I would need this tweak to be easy to manage.

My idea would be to use the forumjump template to improve that product.

Something like this, where when clicked on, would post the thread in :

PHP Code:

<div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">
    <
form action="forumdisplay.php" method="get">
    <
input type="hidden" name="s" value="$session[sessionhash]/>
    <
input type="hidden" name="daysprune" value="$daysprune/>
    <
strong>$vbphrase[forum_jump]</strong><br />
    <
select name="f" onchange="this.form.submit();">
        <
optgroup label="$vbphrase[forums]">
        
$jumpforumbits
        
</optgroup>
    </
select>$gobutton
    
</form>
</
div

Would it be possible to have this?

Using the forum jump menu isn't a bad idea. Never thought of that. :)

I don't see why it wouldn't work and all the code looks ok (but I'm no programmer either - still learning as said above).

All you can do is give it a go and see what happens.

You seem to know more about this stuff then me anyway! :p

Limerick 04-23-2007 03:23 PM

Hey rayw,

I don't think I know more than you: I just copied the forumjump code. But I don't think, this could work as these link are not designed to save posts but just to jump to...

Maybe some coder around here may help us...

icemanic 04-25-2007 02:34 AM

im totally clueless trying to customize my own form, can anyone help me via PM ?????

im trying to add several $normalquestion .....but do i just add $normalquestion2

it does not show up, etc

HELP!

Deepdog009 04-26-2007 11:47 AM

Quote:

Originally Posted by Mookie (Post 1230148)
I am having a problem with the form hack. I am receiving a error

Code:

Invalid Forum specified. If you followed a valid link, please notify the administrator
Does anyone know how to fix this error. I have tried almost everything... I guess there is something that I have not tried yet.

Double check your form names, that message says something is wrong with your form name or something in your plugin code is not matching forms.

Maybe the link has one letter wrong.

Good Luck;)

Deepdog009 04-26-2007 11:59 AM

Quote:

Originally Posted by icemanic (Post 1235069)
im totally clueless trying to customize my own form, can anyone help me via PM ?????

im trying to add several $normalquestion .....but do i just add $normalquestion2

it does not show up, etc

HELP!

Icemanic its possible that you forgot something in one of your forms or your plugin code isn't matching.

Check form names
Check form answer area
Check main form and verify that its got the correct html that will show all boxes or message areas.

HTML Code:

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

// Part 2
$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$answer4 = $vbulletin->GPC['answer4'];
$answer5 = $vbulletin->GPC['answer5'];
$radioanswer1 = $vbulletin->GPC['radioanswer1'];
$radioanswer1other = $vbulletin->GPC['radioanswer1other'];
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$normalanswer2 = $vbulletin->GPC['normalanswer2'];

Next check your forms templates 2 verify that all is matching and is placed correctly.

Good Luck!:)

Deepdog009 04-27-2007 12:01 PM

HTML Code:

$formtitle
$bbuserinfo[username]

$question1
$answer1

$question2
$answer2

$question3
$answer3

$question4
$answer4

$question5
$answer5

$radioquestion1
$radioanswer1
$radioanswer1other

$normalquestion1
$normalanswer1

$normalquestion2
$normalanswer2

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

$vbtextquestion

$vbtextanswer

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

Here is the main form Html info 4 this answer sheet

HTML Code:

<tr>
        <td class="alt1" colspan="3">
                                <b>$normalquestion1</b>
                </td>
        </tr>
<tr>
<td class="alt2" colspan="3">
<input type="text" size="30" value="$normalanswer1" name="normalanswer1" />
</td>
</tr>

Good Luck!:eek:

T_Richardson 04-28-2007 04:23 AM

I have a flash form and sends data via email. Would anyone know of a way to make a post in the forums by using the data sent by a flash form?

Part of my email.php

PHP Code:

<?php

$sendTo 
"webmaster@website.com";
$subject "Recruitment Form Submission";

$headers "From: " $_POST["firstName"] ." "$_POST["lastname"] . "<" $_POST["email"] .">\r\n";
$headers .= "Reply-To: " $_POST["email"] . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Return-path: " $_POST["email"];

$game_name "Game_Name: " $_POST["game_name"]."<br>" ." Location: "$_POST["location"];

mail($sendTo$subject$game_name$headers);

?>


MoB Zigmister 04-30-2007 06:11 AM

Error: Invalid Forum specified. My url is correct for sure.

When I install the custom form it takes down the unmodified original form, displaying the same error. The theme was also edited, but since the custom plugin made both forms crash it is the root of the problem, no? I can produce the template code if needed.

Any help would be greatly appreciated, especially after 3 nights of failure.

Plugin:
Code:

<plugin active="1" executionorder="4">
                        <title>form1</title>
                        <hookname>newthread_start</hookname>
                        <phpcode><![CDATA[$formname = "form1";

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

$vbulletin->input->clean_array_gpc('p', array(
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'answer4' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'answer5' => TYPE_STR,
'answer6' => TYPE_STR,
'answer7' => TYPE_STR,
'answer8' => TYPE_STR,
'longanswer1' => TYPE_STR,
'longanswer2' => TYPE_STR,
'longanswer3' => TYPE_STR,
'longanswer4' => TYPE_STR,
'longanswer5' => TYPE_STR,
'longanswer6' => TYPE_STR,
'longanswer7' => TYPE_STR,
'longanswer8' => TYPE_STR,
'longanswer9' => TYPE_STR
));

$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$answer4 = $vbulletin->GPC['answer4'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$answer5 = $vbulletin->GPC['answer5'];
$answer6 = $vbulletin->GPC['answer6'];
$answer7 = $vbulletin->GPC['answer7'];
$answer8 = $vbulletin->GPC['answer8'];
$longanswer1 = $vbulletin->GPC['longanswer1'];
$longanswer2 = $vbulletin->GPC['longanswer2'];
$longanswer3 = $vbulletin->GPC['longanswer3'];
$longanswer4 = $vbulletin->GPC['longanswer4'];
$longanswer5 = $vbulletin->GPC['longanswer5'];
$longanswer6 = $vbulletin->GPC['longanswer6'];
$longanswer7 = $vbulletin->GPC['longanswer7'];
$longanswer8 = $vbulletin->GPC['longanswer8'];
$longanswer9 = $vbulletin->GPC['longanswer9'];

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

$maintemplate = "form1";
$answertemplate = "form1answers";

$formforum = "0";

$formforumid = "89";

$formpoll = "0";
$polloption[1] = "Yes";
$polloption[2] = "No";
$polloption[3] = "Maybe";

$pollpublic = "0";

$formreply = "0";

$formreplythreadid = "12345";

$formpm = "1";

$formpmname = "MoB Zigmister";

$formemail = "0";

$formemailaddress = "youremail@yourforums.com";

$allow_attachments = "0";

$redirectoption = "0";

$errormessage = "Thank you";

$answerall = "0";

$formtitle = "form1";

$posttitle = "$formtitle - $bbuserinfo[username]";

$formpurpose = "purpose";

$question1 = "1";
$explain1 = "1e";
$question2 = "2";
$explain2 = "2e";
$question3 = "3";
$explain3 = "3e";
$question4 = "4";
$explain4 = "4e";
$dropdownquestion1 = "Gender";
$dropdownchoice1a = "No Comment";
$dropdownchoice1b = "Female";
$dropdownchoice1c = "Male";
$question5 = "5";
$explain5 = "5e";
$question6 = "6";
$explain6 = "6e";
$question7 = "7";
$question8 = "8";
$longquestion1 = "l1";
$longquestion2 = "l2";
$longquestion3 = "l3";
$longquestion4 = "l4";
$longquestion5 = "l5";
$longquestion6 = "l6";
$longquestion7 = "l7";
$longquestion8 = "l8";
$longquestion9 = "l9";

if ($_REQUEST['action'] == '')
{
  $_REQUEST['action'] = "form";
}


$bbuserinfo = $vbulletin->userinfo;

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

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

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

    if ($answerall == "1")
    {
        if ($answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $answer4 == '' OR $answer5 == '' $answer6 == '' OR  $answer7 == '' OR $answer8 == '' OR $longanswer1 == '' OR $longanswer2 == '' OR $longanswer3 == '' OR $longanswer4 == '' OR $longanswer5 == '' OR $longanswer6 == '' OR $longanswer7 == '' OR $longanswer8 == '' OR $longanswer9 == '')
        {
            $errormessage = "$bbuserinfo[username], you need to answer every question!";
            eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
            exit();
        }
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if ($formemail == "1")
            {
                        require_once(DIR . '/includes/class_bbcode_alt.php');
                        $plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
                        $plaintext_parser->set_parsing_language($touserinfo['languageid']);
                        $formsend = $plaintext_parser->parse($formsend);

                    $emails = explode(';', $formemailaddress);
                    foreach ($emails AS $email)
                    {
                        vbmail($email, $posttitle, $formsend);
                        }
            }

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

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

if ($_REQUEST['action'] == 'form')
{
        if (($formforum OR $formreply) AND $allow_attachments)
        {
                if ($formforum AND $formreply)
                {
                        $forumid = $formforumid;
                }
                else if ($formreply)
                {
                        $threadid = $formreplythreadid;
                $threadinfo = verify_id('thread', $threadid, 0, 1);
                $forumid = $threadinfo[forumid];
                }
                else
                {
                        $forumid = $formforumid;
                }

        $forumperms = fetch_permissions($forumid);

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

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

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

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

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

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

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

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

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

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

        eval('print_output("' . fetch_template("$maintemplate") . '");');
}
}]]></phpcode>
                </plugin>


XxBuLLeTz 05-01-2007 09:57 AM

I like this hack alot. But us there anyway to delete the text box at the bottom of the page (Im talking about the text box that you use to reply to a thread).

ComputerVitals 05-01-2007 12:45 PM

Quote:

Originally Posted by XxBuLLeTz (Post 1238810)
I like this hack alot. But us there anyway to delete the text box at the bottom of the page (Im talking about the text box that you use to reply to a thread).


Thats in the Form template in your "Styles and Templates.

ComputerVitals 05-01-2007 10:04 PM

I added a if statement.
It will either show the bbuser[email] or a text input for them to add a email address.

this works great, shows in the post, and in the PM. Also the email you set in the hook sends like it should.
But I also want to send an email to the user that same form.
Any idea how?

Deepdog009 05-02-2007 11:48 AM

Quote:

Originally Posted by MoB Zigmister (Post 1238044)
Error: Invalid Forum specified. My url is correct for sure.

When I install the custom form it takes down the unmodified original form, displaying the same error. The theme was also edited, but since the custom plugin made both forms crash it is the root of the problem, no? I can produce the template code if needed.

Any help would be greatly appreciated, especially after 3 nights of failure.

Plugin:
Code:

<plugin active="1" executionorder="4">
                        <title>form1</title>
                        <hookname>newthread_start</hookname>
                        <phpcode><![CDATA[$formname = "form1";

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

$vbulletin->input->clean_array_gpc('p', array(
'answer1' => TYPE_STR,
'answer2' => TYPE_STR,
'answer3' => TYPE_STR,
'answer4' => TYPE_STR,
'dropdownanswer1' => TYPE_STR,
'answer5' => TYPE_STR,
'answer6' => TYPE_STR,
'answer7' => TYPE_STR,
'answer8' => TYPE_STR,
'longanswer1' => TYPE_STR,
'longanswer2' => TYPE_STR,
'longanswer3' => TYPE_STR,
'longanswer4' => TYPE_STR,
'longanswer5' => TYPE_STR,
'longanswer6' => TYPE_STR,
'longanswer7' => TYPE_STR,
'longanswer8' => TYPE_STR,
'longanswer9' => TYPE_STR
));

$answer1 = $vbulletin->GPC['answer1'];
$answer2 = $vbulletin->GPC['answer2'];
$answer3 = $vbulletin->GPC['answer3'];
$answer4 = $vbulletin->GPC['answer4'];
$dropdownanswer1 = $vbulletin->GPC['dropdownanswer1'];
$answer5 = $vbulletin->GPC['answer5'];
$answer6 = $vbulletin->GPC['answer6'];
$answer7 = $vbulletin->GPC['answer7'];
$answer8 = $vbulletin->GPC['answer8'];
$longanswer1 = $vbulletin->GPC['longanswer1'];
$longanswer2 = $vbulletin->GPC['longanswer2'];
$longanswer3 = $vbulletin->GPC['longanswer3'];
$longanswer4 = $vbulletin->GPC['longanswer4'];
$longanswer5 = $vbulletin->GPC['longanswer5'];
$longanswer6 = $vbulletin->GPC['longanswer6'];
$longanswer7 = $vbulletin->GPC['longanswer7'];
$longanswer8 = $vbulletin->GPC['longanswer8'];
$longanswer9 = $vbulletin->GPC['longanswer9'];

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

$maintemplate = "form1";
$answertemplate = "form1answers";

$formforum = "0";

$formforumid = "89";

$formpoll = "0";
$polloption[1] = "Yes";
$polloption[2] = "No";
$polloption[3] = "Maybe";

$pollpublic = "0";

$formreply = "0";

$formreplythreadid = "12345";

$formpm = "1";

$formpmname = "MoB Zigmister";

$formemail = "0";

$formemailaddress = "youremail@yourforums.com";

$allow_attachments = "0";

$redirectoption = "0";

$errormessage = "Thank you";

$answerall = "0";

$formtitle = "form1";

$posttitle = "$formtitle - $bbuserinfo[username]";

$formpurpose = "purpose";

$question1 = "1";
$explain1 = "1e";
$question2 = "2";
$explain2 = "2e";
$question3 = "3";
$explain3 = "3e";
$question4 = "4";
$explain4 = "4e";
$dropdownquestion1 = "Gender";
$dropdownchoice1a = "No Comment";
$dropdownchoice1b = "Female";
$dropdownchoice1c = "Male";
$question5 = "5";
$explain5 = "5e";
$question6 = "6";
$explain6 = "6e";
$question7 = "7";
$question8 = "8";
$longquestion1 = "l1";
$longquestion2 = "l2";
$longquestion3 = "l3";
$longquestion4 = "l4";
$longquestion5 = "l5";
$longquestion6 = "l6";
$longquestion7 = "l7";
$longquestion8 = "l8";
$longquestion9 = "l9";

if ($_REQUEST['action'] == '')
{
  $_REQUEST['action'] = "form";
}


$bbuserinfo = $vbulletin->userinfo;

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

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

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

    if ($answerall == "1")
    {
        if ($answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $answer4 == '' OR $answer5 == '' $answer6 == '' OR  $answer7 == '' OR $answer8 == '' OR $longanswer1 == '' OR $longanswer2 == '' OR $longanswer3 == '' OR $longanswer4 == '' OR $longanswer5 == '' OR $longanswer6 == '' OR $longanswer7 == '' OR $longanswer8 == '' OR $longanswer9 == '')
        {
            $errormessage = "$bbuserinfo[username], you need to answer every question!";
            eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
            exit();
        }
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if ($formemail == "1")
            {
                        require_once(DIR . '/includes/class_bbcode_alt.php');
                        $plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
                        $plaintext_parser->set_parsing_language($touserinfo['languageid']);
                        $formsend = $plaintext_parser->parse($formsend);

                    $emails = explode(';', $formemailaddress);
                    foreach ($emails AS $email)
                    {
                        vbmail($email, $posttitle, $formsend);
                        }
            }

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

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

if ($_REQUEST['action'] == 'form')
{
        if (($formforum OR $formreply) AND $allow_attachments)
        {
                if ($formforum AND $formreply)
                {
                        $forumid = $formforumid;
                }
                else if ($formreply)
                {
                        $threadid = $formreplythreadid;
                $threadinfo = verify_id('thread', $threadid, 0, 1);
                $forumid = $threadinfo[forumid];
                }
                else
                {
                        $forumid = $formforumid;
                }

        $forumperms = fetch_permissions($forumid);

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

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

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

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

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

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

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

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

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

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

        eval('print_output("' . fetch_template("$maintemplate") . '");');
}
}]]></phpcode>
                </plugin>


MoB Zigmister zip all three files ( both templates and plugin) in txt format and upload, I shall check it out 4 ya.???

Deepdog009 05-02-2007 11:53 AM

Quote:

Originally Posted by T_Richardson (Post 1236842)
I have a flash form and sends data via email. Would anyone know of a way to make a post in the forums by using the data sent by a flash form?

Part of my email.php

PHP Code:

<?php

$sendTo 
"webmaster@website.com";
$subject "Recruitment Form Submission";

$headers "From: " $_POST["firstName"] ." "$_POST["lastname"] . "<" $_POST["email"] .">\r\n";
$headers .= "Reply-To: " $_POST["email"] . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Return-path: " $_POST["email"];

$game_name "Game_Name: " $_POST["game_name"]."<br>" ." Location: "$_POST["location"];

mail($sendTo$subject$game_name$headers);

?>


Yes it should be possible, but it will take some modifications. Zip yo files and upload T_Richardson. I shall take a look into implementing this. I was just thinking about creating some flash forms last month. Very busy so give me some time if you be interested.

Good luck:cool:

samual 05-02-2007 02:21 PM

Can someone give me a hand? I am trying to add some more fields to this form. Under "normal question 1" I would like to add a few more questions. here is what I did but had no luck. What do I need to do to get these fields to show up?

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

// Part 2
$normalanswer1 = $vbulletin->GPC['normalanswer1'];
$normalanswer2 = $vbulletin->GPC['normalanswer2']; (I added)

$normalquestion1 = "What is your Character's Name";

$normalquestion2 = "Character's Race"; (I added)

I have allot more questions that I would like to add. What am I missimg?

ComputerVitals 05-02-2007 02:25 PM

Quote:

Originally Posted by samual (Post 1239757)
Can someone give me a hand? I am trying to add some more fields to this form. Under "normal question 1" I would like to add a few more questions. here is what I did but had no luck. What do I need to do to get these fields to show up?

I have allot more questions that I would like to add. What am I missimg?

Now you have to look in your templates
"form" template

Look for:
[/code]
<tr>
<td class="alt1" valign="middle">
<b>$question2</b>:<br />
$explain2</td>
<td class="alt1" valign="middle" colspan="2">
<input type="text" size="30" value="$answer2" name="answer2" /></td>
</tr>[/code]

And adjust as needed. Or copy that and change the "$normalquestion2" Same goes for the answer2 values.

ComputerVitals 05-02-2007 02:26 PM

Quote:

Originally Posted by ComputerVitals (Post 1239315)
I added a if statement.
It will either show the bbuser[email] or a text input for them to add a email address.

this works great, shows in the post, and in the PM. Also the email you set in the hook sends like it should.
But I also want to send an email to the user that same form.
Any idea how?

I got the the hook to send the form to the registered user as well. But.

I would like to put a link to the thread in the email.
how do I do that?


All times are GMT. The time now is 07:25 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02988 seconds
  • Memory Usage 2,155KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (6)bbcode_html_printable
  • (4)bbcode_php_printable
  • (18)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete