Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
FORM to THREAD/ FORUM/ POLL/ PM/ EMAIL - CUSTOMIZABLE FORMS - Mod Apps, Orders, News. Details »»
FORM to THREAD/ FORUM/ POLL/ PM/ EMAIL - CUSTOMIZABLE FORMS - Mod Apps, Orders, News.
Version: 1.00, by Erwin Erwin is offline
Developer Last Online: May 2013 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 06-11-2004 Last Update: Never Installs: 214
 
No support by the author.

FORM to THREAD/ FORUM/ POLL/ PM/ EMAIL - Totally CUSTOMIZABLE FORMS
Version 1.6 for vBulletin 3.x.x by Dr Erwin Loh

Features:

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

1. Posted into a new thread in a forum of your choice
2. Create a new poll in the new thread with options of your choice
3. Posted as a reply in an existing thread of your choice
4. PMed to you or someone else
5. Emailed to an email address you specify
6. Choose to redirect to the post, thread or forum, or a custom thank you message
7. Choose to redirect to editpost to upload attachments

Or any combination or all of the above?

Well, this is the hack for you!

You can use this for:

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


Or anything you like - this hack is totally customizable via the PHP file.
Basically, this hack involves modifying 1 PHP file form.php (you add questions, options etc. in the PHP file itself), uploading it, and then adding 2 templates.

The beauty of this hack is that once you have added the 2 templates, to make a new form, all you need to do is copy the form.php and rename it to form2.php, edit the variables in the PHP file, and you have a totally new form!!! You do not need to touch the templates again.

Format of the form:

1. One main input question
2. 2 Radio buttons Choice questions
3. 3 Normal text input questions
4. 1 Long answer question

This is customizable via the PHP file.

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


INSTALLATION


Easy - takes only a few minutes:

1. Add the 2 templates.

2. Edit form.php - the instructions are all inside the PHP file itself, in the top half. Follow the instructions carefully!

3. Upload form.php

Just link to form1.php eg. http://www.yourforum.com/forums/form.php

Done!

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

Enjoy!


Updates:

Version 1.1 - Option to force user to answer all questions.
Version 1.2 - Thread count and lastposter information now updated if form is sent to existing thread.
Version 1.3 - ADDED CREATE POLL OPTION!
Version 1.4 - Fixed bug with Form-to-thread code
Version 1.5 - Major update:
- fixed bug where thread count not updated when form to forum
- fixed default posting to allow smilies and sigs when reply to thread
- added templates to cache (saves 2 queries)
- added option to change thank you message
- added options to redirect to post, thread or forum when submit
Version 1.6 - Choose to redirect to editpost to upload attachments

Screenshot is an example of a form - the form title and questions are customizable:

Show Your Support

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

Comments
  #437  
Old 06-16-2005, 12:12 PM
jeepinaround jeepinaround is offline
 
Join Date: Nov 2004
Location: Colorado Springs, Co
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It was easy, just some code to change. It is posted in this thread some where.
Reply With Quote
  #438  
Old 06-17-2005, 02:05 AM
GiJoe GiJoe is offline
 
Join Date: Dec 2004
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by paul41598
I have figured out a way to do dropdowns if anyone is interested
Yes :nervous:
Reply With Quote
  #439  
Old 06-18-2005, 04:47 PM
MrTchMan MrTchMan is offline
 
Join Date: May 2004
Location: SLC
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am having a problem. I have set up the form to require all information to be filled in. I was testing it out and if I complete the form it would give me a error message. When I hot the back button the error message stays up and I have to refresh the form before it will come back up and I loose all the information. Any Ideas???

Thanks
Reply With Quote
  #440  
Old 06-20-2005, 05:06 PM
jeepinaround jeepinaround is offline
 
Join Date: Nov 2004
Location: Colorado Springs, Co
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can no one help me out? After filling out the form I get a blank thread. No errors or anything.
Reply With Quote
  #441  
Old 06-20-2005, 07:49 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please double check edits/templates.
Reply With Quote
  #442  
Old 06-20-2005, 09:14 PM
midnightz midnightz is offline
 
Join Date: Jan 2003
Location: Inside the Velvet Tunnel
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello

I also believe in theory it would be easy to add a browse feature and then it could upload a file (lets say banner) into a directory in forums (ie forums/banners/)

Thank you - this is the last tweak I need for this to be perfect!
Reply With Quote
  #443  
Old 06-20-2005, 11:07 PM
jeepinaround jeepinaround is offline
 
Join Date: Nov 2004
Location: Colorado Springs, Co
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah I triple checked everything and no luck so I had to take it off. I didn't really want to as when it was working it was exactly what I needed. To me it seems as though it quit working when I upgraded to 3.0.7. No way to prove it and I am moderate at coding php. I can get around it and see things that I wouldn't have just 1 year ago but still no luck with this mod. Still if anyone has any suggestions please post them as I would love for this to work again. I just needed to make the forum so people could at least post in it.
Reply With Quote
  #444  
Old 06-21-2005, 01:15 PM
MrTchMan MrTchMan is offline
 
Join Date: May 2004
Location: SLC
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MrTchMan
I am having a problem. I have set up the form to require all information to be filled in. I was testing it out and if I complete the form it would give me a error message. When I hot the back button the error message stays up and I have to refresh the form before it will come back up and I loose all the information. Any Ideas???

Thanks

Anyone have any ideas?
Reply With Quote
  #445  
Old 06-21-2005, 01:42 PM
midnightz midnightz is offline
 
Join Date: Jan 2003
Location: Inside the Velvet Tunnel
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MrTchMan
Anyone have any ideas?
On line 137


PHP Code:
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
////////////////////////////////////////////////////////////////////////////////////////////////////

$answerall "0"
Change 0 to variable 1.

and make sure you have all created fields (lets say answer 9) in form / form answers / and inside the php file and bottom code on line 234 to 235

where it says:

PHP Code:
if ($answerall == "1") {
    if (
$normalanswer1 == '' OR $radioanswer1 == '' OR $radioanswer2 == 
etc....
Reply With Quote
  #446  
Old 06-21-2005, 02:00 PM
MrTchMan MrTchMan is offline
 
Join Date: May 2004
Location: SLC
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by midnightz
On line 137


PHP Code:
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
////////////////////////////////////////////////////////////////////////////////////////////////////

$answerall "0"
Change 0 to variable 1.

and make sure you have all created fields (lets say answer 9) in form / form answers / and inside the php file and bottom code on line 234 to 235

where it says:

PHP Code:
if ($answerall == "1") {
    if (
$normalanswer1 == '' OR $radioanswer1 == '' OR $radioanswer2 == 
etc....
Here is my form.php I have that option checked. It does requre me to fill out all info but when a user doesn't it gives them the error message and when they hit back it doesn't go back. Maybe I am over looking something. THanks in advance

PHP Code:
<?php

/*======================================================================*\
|| #################################################################### ||
|| # FORM TO THREAD/ FORUM/ PM/ EMAIL - Totally CUSTOMIZABLE FORMS    # ||
|| # Version 1.6 for vBulletin 3.x.x by Dr Erwin Loh                  # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000?2004 Dr Erwin Loh. All Rights Reserved.          # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| #################################################################### ||
\*======================================================================*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

$globaltemplates = array(
    
'form',
    
'formanswers'
);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

globalize($_POST, array(
'normalanswer1' => STR,
'answer1' => STR,
'answer2' => STR,
'answer3' => STR,
'answer4' => STR,
'answer5' => STR,
'answer6' => STR,
'answer7' => STR,
'answer8' => STR,
'answer9' => STR,
'answer10' => STR,
'answer11' => STR,
'longanswer1' => STR,
'action' => STR
));

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//USERGROUPS ALLOWED
//You can add or remove usegroups that are ALLOWED to use this form by changing the numbers below in the array 
////////////////////////////////////////////////////////////////////////////////////////////////////

if (!in_array($bbuserinfo['usergroupid'], array(2,5,6,7,9,10))) print_no_permission();

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NAME OF THIS PHP FILE AND TEMPLATES - DO THIS BIT IF YOU ARE MAKING MORE FORMS!
//You can easily make more forms by just copying this file, renaming it, and modifying the variable in
//this file. You can keep the same templates for different forms. For more customization, you can 
//use different templates, by renaming and modifying the templates.
////////////////////////////////////////////////////////////////////////////////////////////////////

// Name of this file
$phpfilename "form.php";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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
$formforumid "24";

//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll "0";
$formoption1 "Yes";
$formoption2 "No";

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

//ENABLE FORM TO REPLY TO EXISTING THREAD
$formreply "0";

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

//FORUM ID WHERE THE EXISTING THREAD IS IN
$formreplyforumid "456";

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

//ENABLE FORM TO BE PMED - 1 = yes, 0 = no
$formpm "0";

//USERID TO PM TO
$formpmid "1";

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

//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
// 1 - redirect to post
// 2 - redirect to thread
// 3 - redirect to forum
// 4 - redirect to editpost to upload attachments
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption "4";

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
////////////////////////////////////////////////////////////////////////////////////////////////////

$answerall "1";

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

$formtitle "Trading Post Form";

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

$formpurpose "The purpose of this form is to create a standard way of entering items for sale in the flea market. If you item is not a cell phone please put a N/A in all fields that don't apply to you, and then post all your details in the additional details section";

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

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

$normalquestion1 "What is the title of your thread?";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$question1 "What is your asking price?";
$explain1 "Please enter a asking price. If it is a trade specify what you are looking for";

//QUESTION 2 (do not use quotation marks or you will get a parse error)
$question2 "What color is the item";
$explain2 "Please enter the color of the item.";

//QUESTION 3 (do not use quotation marks or you will get a parse error)
$question3 "What is included?";
$explain3 "Please let people know what is included with your item";

//QUESTION 4 (do not use quotation marks or you will get a parse error)
$question4 "What Service Provider?";
$explain4 "List the networks this phone has been used or tested on.";

//QUESTION 5 (do not use quotation marks or you will get a parse error)
$question5 "What is the life timer?";
$explain5 "Please enter your life time here. For sprint phones press ##786#";

//QUESTION 6 (do not use quotation marks or you will get a parse error)
$question6 "What is the condition of the item?";
$explain6 "Item Condition.";

//QUESTION 7 (do not use quotation marks or you will get a parse error)
$question7 "Do you have pictures?";
$explain7 "If you have pictures post them in additional details box via the [img] code or click submit and add an attachment";

//QUESTION 8 (do not use quotation marks or you will get a parse error)
$question8 "What is the location you are shipping from?";
$explain8 "Please enter a location.";

//QUESTION 9 (do not use quotation marks or you will get a parse error)
$question9 "What is your shipping method";
$explain9 "Shipping terms and how will you ship. Please inlcude Price.";

//QUESTION 10 (do not use quotation marks or you will get a parse error)
$question10 "What Payment methods do you accept?";
$explain10 "Please list preferred payment methods";

//QUESTION 11 (do not use quotation marks or you will get a parse error)
$question11 "How can users contact you?";
$explain11 "Contact Information";

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

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

$longquestion1 "What are your additional details?.";
$longexplain1 "Please use this area to enter more details. (i.e. Why you are selling) You can also use this space to put in any information that you could not in the above questions. Like items other than cell phones.";

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

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// start navbar
$navbits = array(
    
"$phpfilename?$session[sessionurl]=> $formtitle
);

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

if (
$action=="submit") {

if (
$answerall == "1") {
    if (
$normalanswer1 == '' OR $answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $answer4 == '' OR $answer5 == '' OR $answer6 == '' OR $answer7 == '' OR $answer8 == '' OR $answer9 == '' OR $answer10 == '' OR $answer11 == '' OR $longanswer1 == '' OR $ad_agree <> 'Confirmed')
    {
    
$errormessage "Please complete all the information on the classified submission form and agree that you have read and abide by the trading rules.<br>Press the Back button to return to the form."
    eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");'); 
    exit(); 
    } 


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

    if (
$formforum == "1") {
                    
$DB_site->query("
                                INSERT INTO " 
TABLE_PREFIX "thread(title, lastpost, forumid, open, replycount,
                                postusername, postuserid, lastposter, dateline, iconid, visible, attach)
                                VALUES
                                        ('normalanswer1', " 
TIMENOW ", $formforumid,
                                         1, 0, '" 
addslashes($bbuserinfo['username']) . "', $bbuserinfo[userid],
                                         '" 
addslashes($bbuserinfo['username']) . "', " TIMENOW ", 0, 1,
                                         0)
                        "
);
                
$thread['threadid'] = $DB_site->insert_id();
                
$DB_site->query("
                        INSERT INTO " 
TABLE_PREFIX "post
                                (threadid, title, username, userid, dateline, pagetext, allowsmilie,
                                 showsignature, iconid, visible)
                        VALUES
                                (
$thread[threadid], '$normalanswer1',
                                 '" 
addslashes($bbuserinfo['username']) . "', $bbuserinfo[userid], " TIMENOW ",
                                 '" 
addslashes($formsend) . "', 1, 1,
                                 0, 1)
                "
);
                
$post['postid'] = $DB_site->insert_id();
                
$DB_site->query("
                                UPDATE " 
TABLE_PREFIX "thread
                                SET firstpostid = 
$post[postid]
                                WHERE threadid = 
$thread[threadid]
                        "
);
                
$DB_site->query("
                                UPDATE " 
TABLE_PREFIX "forum
                                SET replycount = replycount +  1,
                                threadcount = threadcount + 1,
                                lastpost = " 
TIMENOW ",
                                lastposter = '" 
addslashes($bbuserinfo['username']) . "',
                                lastthread = '
$normalanswer1',
                                lastthreadid = 
$thread[threadid]
                                WHERE forumid = 
$formforumid
                        "
);
                
$DB_site->query(
                                UPDATE " 
TABLE_PREFIX "user 
                                SET posts = posts + 1 
                                WHERE userid = 
$bbuserinfo[userid] 
                        "
); 
$forum[forumid] = $formforumid;
    }

    if (
$formpoll == "1") {
              
$DB_site->query("INSERT INTO " TABLE_PREFIX "poll (question,dateline,options,votes,active,numberoptions,timeout,multiple,public) VALUES ('$normalanswer1'," TIMENOW ",'$formoption1|||$formoption2','" addslashes("0|||0") . "',1,2,0,0,0)");
            
$pollid $DB_site->insert_id();
            
$DB_site->query("UPDATE " TABLE_PREFIX "thread SET pollid = '".$pollid."' WHERE threadid = '".$thread[threadid]."'");
}

    if (
$formreply == "1") {
      
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$formreplythreadid','$normalanswer1','".addslashes($bbuserinfo[username])."','$bbuserinfo[userid]','".time()."','" addslashes($formsend) . "','1','1','0','0','1')");
      
$DB_site->query("UPDATE thread SET replycount = replycount + 1, lastpost = " TIMENOW ", lastposter = '".addslashes($bbuserinfo[username])."' WHERE threadid = $formreplythreadid"); 
                      
$DB_site->query("
                                UPDATE " 
TABLE_PREFIX "forum
                                SET replycount = replycount +  1,
                                lastpost = " 
TIMENOW ",
                                lastposter = '"
.addslashes(htmlspecialchars($bbuserinfo[username]))."',
                                lastthread = '" 
addslashes($bbuserinfo['username']) . $formtitle',
                                lastthreadid = 
$formreplythreadid
                                WHERE forumid = 
$formreplyforumid
                        "
);
      
$DB_site->query(
                                UPDATE " 
TABLE_PREFIX "user 
                                SET posts = posts + 1 
                                WHERE userid = 
$bbuserinfo[userid] 
                        "
); 
$forum[forumid] = $formreplyforumid;
    }

if (
$formpm == "1") {
$DB_site->query("INSERT INTO " TABLE_PREFIX "pmtext\n\t(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature)\nVALUES\n\t($bbuserinfo[userid], '" addslashes($bbuserinfo['username']) . "', '".addslashes(htmlspecialchars($formtitle))."', '".addslashes(htmlspecialchars($formsend))."', '" addslashes(serialize($tostring)) . "', 0, " TIMENOW ", 1)");
$pmtextid $DB_site->insert_id();
$DB_site->query("INSERT INTO " TABLE_PREFIX "pm (pmtextid, userid, messageread) VALUES ($pmtextid$formpmid, 0)");
$DB_site->shutdown_query("UPDATE " TABLE_PREFIX "user SET pmtotal=pmtotal+1, pmunread=pmunread+1 WHERE userid = $formpmid");
    }

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

if (
$redirectoption == "1") {
            
$url "showthread.php?$session[sessionurl]p=$post[postid]";
            eval(
print_standard_redirect('redirect_postthanks'));
   exit();

if (
$redirectoption == "2") {
            
$url "showthread.php?$session[sessionurl]t=$thread[threadid]";
            eval(
print_standard_redirect('redirect_postthanks'));
   exit();

if (
$redirectoption == "3") {
            
$url "forumdisplay.php?$session[sessionurl]f=$forum[forumid]";
        eval(
print_standard_redirect('redirect_postthanks'));
   exit();
}
if (
$redirectoption == "4") { 
            
$url "editpost.php?do=editpost&$session[sessionurl]p=$post[postid]"
            eval(
print_standard_redirect('redirect_postthanks')); 
   exit(); 

   eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");');
   exit();
}
eval(
'print_output("' fetch_template('form') . '");');
?>
Reply With Quote
  #447  
Old 06-21-2005, 03:15 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is a documentation I wrote up for anyone who wants dropdowns as well, in their forms.


Good luck, and enjoy!
Reply With Quote
  #448  
Old 06-22-2005, 09:39 PM
bluesteel bluesteel is offline
 
Join Date: Feb 2003
Location: Macclesfield, UK
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Erwin,

Great hack! Very flexible and just what I was looking for. Thanks!

I have a question for either your good self, or anyone else who might like to reply.

Is there a line of code or something that I can add to the form.php file that puts the new thread in the ACP Thread Moderation queue? I have the specific forum that the new thread is created in set for new Threads to be Moderated, but the form.php ignores this and posts.
If you know what I mean! :squareeyed:

Thanks in advance for any help that may be forthcoming guys.

Alan
Reply With Quote
  #449  
Old 06-24-2005, 09:06 PM
jaredvolkl jaredvolkl is offline
 
Join Date: May 2005
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by bluesteel
Hi Erwin,

Great hack! Very flexible and just what I was looking for. Thanks!

I have a question for either your good self, or anyone else who might like to reply.

Is there a line of code or something that I can add to the form.php file that puts the new thread in the ACP Thread Moderation queue? I have the specific forum that the new thread is created in set for new Threads to be Moderated, but the form.php ignores this and posts.
If you know what I mean! :squareeyed:

Thanks in advance for any help that may be forthcoming guys.

Alan
This is exactly what I need to do. I have a forum that I'd like new threads posted to go into moderation when they are posted through this form. I've tried setting the visible value to 0 which gets pushed to both post and thread, but that was no help.
Reply With Quote
  #450  
Old 06-27-2005, 12:57 PM
Marcus Lau Marcus Lau is offline
 
Join Date: May 2002
Location: Singapore
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Erwin ... nin bei dan sibei gu liao! Thanks Erwin and God Bless You Richly!
Reply With Quote
  #451  
Old 06-27-2005, 11:59 PM
MrTchMan MrTchMan is offline
 
Join Date: May 2004
Location: SLC
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone? Please?


Quote:
Originally Posted by MrTchMan
Here is my form.php I have that option checked. It does requre me to fill out all info but when a user doesn't it gives them the error message and when they hit back it doesn't go back. Maybe I am over looking something. THanks in advance

PHP Code:
<?php

/*======================================================================*\
|| #################################################################### ||
|| # FORM TO THREAD/ FORUM/ PM/ EMAIL - Totally CUSTOMIZABLE FORMS    # ||
|| # Version 1.6 for vBulletin 3.x.x by Dr Erwin Loh                  # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000?2004 Dr Erwin Loh. All Rights Reserved.          # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| #################################################################### ||
\*======================================================================*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

$globaltemplates = array(
    
'form',
    
'formanswers'
);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

globalize($_POST, array(
'normalanswer1' => STR,
'answer1' => STR,
'answer2' => STR,
'answer3' => STR,
'answer4' => STR,
'answer5' => STR,
'answer6' => STR,
'answer7' => STR,
'answer8' => STR,
'answer9' => STR,
'answer10' => STR,
'answer11' => STR,
'longanswer1' => STR,
'action' => STR
));

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//USERGROUPS ALLOWED
//You can add or remove usegroups that are ALLOWED to use this form by changing the numbers below in the array 
////////////////////////////////////////////////////////////////////////////////////////////////////

if (!in_array($bbuserinfo['usergroupid'], array(2,5,6,7,9,10))) print_no_permission();

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//NAME OF THIS PHP FILE AND TEMPLATES - DO THIS BIT IF YOU ARE MAKING MORE FORMS!
//You can easily make more forms by just copying this file, renaming it, and modifying the variable in
//this file. You can keep the same templates for different forms. For more customization, you can 
//use different templates, by renaming and modifying the templates.
////////////////////////////////////////////////////////////////////////////////////////////////////

// Name of this file
$phpfilename "form.php";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//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
$formforumid "24";

//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll "0";
$formoption1 "Yes";
$formoption2 "No";

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

//ENABLE FORM TO REPLY TO EXISTING THREAD
$formreply "0";

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

//FORUM ID WHERE THE EXISTING THREAD IS IN
$formreplyforumid "456";

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

//ENABLE FORM TO BE PMED - 1 = yes, 0 = no
$formpm "0";

//USERID TO PM TO
$formpmid "1";

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

//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
// 1 - redirect to post
// 2 - redirect to thread
// 3 - redirect to forum
// 4 - redirect to editpost to upload attachments
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption "4";

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
////////////////////////////////////////////////////////////////////////////////////////////////////

$answerall "1";

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

$formtitle "Trading Post Form";

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

$formpurpose "The purpose of this form is to create a standard way of entering items for sale in the flea market. If you item is not a cell phone please put a N/A in all fields that don't apply to you, and then post all your details in the additional details section";

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

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

$normalquestion1 "What is the title of your thread?";

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

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$question1 "What is your asking price?";
$explain1 "Please enter a asking price. If it is a trade specify what you are looking for";

//QUESTION 2 (do not use quotation marks or you will get a parse error)
$question2 "What color is the item";
$explain2 "Please enter the color of the item.";

//QUESTION 3 (do not use quotation marks or you will get a parse error)
$question3 "What is included?";
$explain3 "Please let people know what is included with your item";

//QUESTION 4 (do not use quotation marks or you will get a parse error)
$question4 "What Service Provider?";
$explain4 "List the networks this phone has been used or tested on.";

//QUESTION 5 (do not use quotation marks or you will get a parse error)
$question5 "What is the life timer?";
$explain5 "Please enter your life time here. For sprint phones press ##786#";

//QUESTION 6 (do not use quotation marks or you will get a parse error)
$question6 "What is the condition of the item?";
$explain6 "Item Condition.";

//QUESTION 7 (do not use quotation marks or you will get a parse error)
$question7 "Do you have pictures?";
$explain7 "If you have pictures post them in additional details box via the [img] code or click submit and add an attachment";

//QUESTION 8 (do not use quotation marks or you will get a parse error)
$question8 "What is the location you are shipping from?";
$explain8 "Please enter a location.";

//QUESTION 9 (do not use quotation marks or you will get a parse error)
$question9 "What is your shipping method";
$explain9 "Shipping terms and how will you ship. Please inlcude Price.";

//QUESTION 10 (do not use quotation marks or you will get a parse error)
$question10 "What Payment methods do you accept?";
$explain10 "Please list preferred payment methods";

//QUESTION 11 (do not use quotation marks or you will get a parse error)
$question11 "How can users contact you?";
$explain11 "Contact Information";

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

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

$longquestion1 "What are your additional details?.";
$longexplain1 "Please use this area to enter more details. (i.e. Why you are selling) You can also use this space to put in any information that you could not in the above questions. Like items other than cell phones.";

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

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// start navbar
$navbits = array(
    
"$phpfilename?$session[sessionurl]=> $formtitle
);

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

if (
$action=="submit") {

if (
$answerall == "1") {
    if (
$normalanswer1 == '' OR $answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $answer4 == '' OR $answer5 == '' OR $answer6 == '' OR $answer7 == '' OR $answer8 == '' OR $answer9 == '' OR $answer10 == '' OR $answer11 == '' OR $longanswer1 == '' OR $ad_agree <> 'Confirmed')
    {
    
$errormessage "Please complete all the information on the classified submission form and agree that you have read and abide by the trading rules.<br>Press the Back button to return to the form."
    eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");'); 
    exit(); 
    } 


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

    if (
$formforum == "1") {
                    
$DB_site->query("
                                INSERT INTO " 
TABLE_PREFIX "thread(title, lastpost, forumid, open, replycount,
                                postusername, postuserid, lastposter, dateline, iconid, visible, attach)
                                VALUES
                                        ('normalanswer1', " 
TIMENOW ", $formforumid,
                                         1, 0, '" 
addslashes($bbuserinfo['username']) . "', $bbuserinfo[userid],
                                         '" 
addslashes($bbuserinfo['username']) . "', " TIMENOW ", 0, 1,
                                         0)
                        "
);
                
$thread['threadid'] = $DB_site->insert_id();
                
$DB_site->query("
                        INSERT INTO " 
TABLE_PREFIX "post
                                (threadid, title, username, userid, dateline, pagetext, allowsmilie,
                                 showsignature, iconid, visible)
                        VALUES
                                (
$thread[threadid], '$normalanswer1',
                                 '" 
addslashes($bbuserinfo['username']) . "', $bbuserinfo[userid], " TIMENOW ",
                                 '" 
addslashes($formsend) . "', 1, 1,
                                 0, 1)
                "
);
                
$post['postid'] = $DB_site->insert_id();
                
$DB_site->query("
                                UPDATE " 
TABLE_PREFIX "thread
                                SET firstpostid = 
$post[postid]
                                WHERE threadid = 
$thread[threadid]
                        "
);
                
$DB_site->query("
                                UPDATE " 
TABLE_PREFIX "forum
                                SET replycount = replycount +  1,
                                threadcount = threadcount + 1,
                                lastpost = " 
TIMENOW ",
                                lastposter = '" 
addslashes($bbuserinfo['username']) . "',
                                lastthread = '
$normalanswer1',
                                lastthreadid = 
$thread[threadid]
                                WHERE forumid = 
$formforumid
                        "
);
                
$DB_site->query(
                                UPDATE " 
TABLE_PREFIX "user 
                                SET posts = posts + 1 
                                WHERE userid = 
$bbuserinfo[userid] 
                        "
); 
$forum[forumid] = $formforumid;
    }

    if (
$formpoll == "1") {
              
$DB_site->query("INSERT INTO " TABLE_PREFIX "poll (question,dateline,options,votes,active,numberoptions,timeout,multiple,public) VALUES ('$normalanswer1'," TIMENOW ",'$formoption1|||$formoption2','" addslashes("0|||0") . "',1,2,0,0,0)");
            
$pollid $DB_site->insert_id();
            
$DB_site->query("UPDATE " TABLE_PREFIX "thread SET pollid = '".$pollid."' WHERE threadid = '".$thread[threadid]."'");
}

    if (
$formreply == "1") {
      
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$formreplythreadid','$normalanswer1','".addslashes($bbuserinfo[username])."','$bbuserinfo[userid]','".time()."','" addslashes($formsend) . "','1','1','0','0','1')");
      
$DB_site->query("UPDATE thread SET replycount = replycount + 1, lastpost = " TIMENOW ", lastposter = '".addslashes($bbuserinfo[username])."' WHERE threadid = $formreplythreadid"); 
                      
$DB_site->query("
                                UPDATE " 
TABLE_PREFIX "forum
                                SET replycount = replycount +  1,
                                lastpost = " 
TIMENOW ",
                                lastposter = '"
.addslashes(htmlspecialchars($bbuserinfo[username]))."',
                                lastthread = '" 
addslashes($bbuserinfo['username']) . $formtitle',
                                lastthreadid = 
$formreplythreadid
                                WHERE forumid = 
$formreplyforumid
                        "
);
      
$DB_site->query(
                                UPDATE " 
TABLE_PREFIX "user 
                                SET posts = posts + 1 
                                WHERE userid = 
$bbuserinfo[userid] 
                        "
); 
$forum[forumid] = $formreplyforumid;
    }

if (
$formpm == "1") {
$DB_site->query("INSERT INTO " TABLE_PREFIX "pmtext\n\t(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature)\nVALUES\n\t($bbuserinfo[userid], '" addslashes($bbuserinfo['username']) . "', '".addslashes(htmlspecialchars($formtitle))."', '".addslashes(htmlspecialchars($formsend))."', '" addslashes(serialize($tostring)) . "', 0, " TIMENOW ", 1)");
$pmtextid $DB_site->insert_id();
$DB_site->query("INSERT INTO " TABLE_PREFIX "pm (pmtextid, userid, messageread) VALUES ($pmtextid$formpmid, 0)");
$DB_site->shutdown_query("UPDATE " TABLE_PREFIX "user SET pmtotal=pmtotal+1, pmunread=pmunread+1 WHERE userid = $formpmid");
    }

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

if (
$redirectoption == "1") {
            
$url "showthread.php?$session[sessionurl]p=$post[postid]";
            eval(
print_standard_redirect('redirect_postthanks'));
   exit();

if (
$redirectoption == "2") {
            
$url "showthread.php?$session[sessionurl]t=$thread[threadid]";
            eval(
print_standard_redirect('redirect_postthanks'));
   exit();

if (
$redirectoption == "3") {
            
$url "forumdisplay.php?$session[sessionurl]f=$forum[forumid]";
        eval(
print_standard_redirect('redirect_postthanks'));
   exit();
}
if (
$redirectoption == "4") { 
            
$url "editpost.php?do=editpost&$session[sessionurl]p=$post[postid]"
            eval(
print_standard_redirect('redirect_postthanks')); 
   exit(); 

   eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");');
   exit();
}
eval(
'print_output("' fetch_template('form') . '");');
?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06154 seconds
  • Memory Usage 2,723KB
  • Queries Executed 30 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (16)post_thanks_box
  • (16)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (16)post_thanks_postbit_info
  • (15)postbit
  • (16)postbit_onlinestatus
  • (16)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete