vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   FORM to THREAD/ FORUM/ POLL/ PM/ EMAIL - CUSTOMIZABLE FORMS - Mod Apps, Orders, News. (https://vborg.vbsupport.ru/showthread.php?t=66082)

PKRWUD 08-28-2004 03:17 AM

Quote:

Originally Posted by alqadir
can i send variables in the form.php. ie. if i made a link that said
<a href="form.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]">

Can I access the forumid variable inside the form.php?
Will the form.php call work?

I am essentially trying to override the newthread.php.

Thanks for all your help so far.


If you're asking me, I don't have a clue. Sorry.

SnowBot 08-28-2004 04:00 AM

Quote:

Originally Posted by PKRWUD
Add $navbar directly underneath $header in the Form template.

$navbar Is already there but i dont get the navbar when the forum is submitted and goes to the "Thank You Message"

I get the navbar when you are answering the questions but not once you submit and get redirected to the "thanks" message.

oldford 08-29-2004 03:36 AM

Quote:

Originally Posted by oldford
I'm talking about the redirect code when you click on "New Thread". I have different form.php files for each forum. I just need the redirect to understand that if it's forumid 123 then clicking on "New Thread" should redirect to form123.php. And if it's forumid 456 it should go to form456.php

OK, finally got this to work. Here's the code if you want to have the "New Thread" button redirect to different forms for different forums. Don't forget to end with the correct number of </if> end tags to close out the code.

HTML Code:

<a href="<if condition="$foruminfo['forumid'] == 123">form123.php<else /><if condition="$foruminfo['forumid'] == 456">form456.php<else />newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]</if></if>">
PKRWUD, it looks like the <elseif> code isn't supported by VB so you need to nest <if> instead. At least according to the manual:
http://www.vbulletin.com/docs/html/m...e_conditionals

dndog 08-29-2004 02:40 PM

Erwin,

I'm trying to make a form where someone can type the name of a website in $answer2 and then paste the link in $answer1 and it will link the word in the post. Here is my edited formanswers template:

PHP Code:

$formtitle
$bbuserinfo
[username]
Link to Site:

<
A HREF="$answer1">$answer2</a

Here is what happens:
PHP Code:

Link to Site

&lt;A HREF=&quot;game name&quot;&gt;http://www.dndonlinegames.com&lt;/a&gt; 

How can I make this work? Thanks!

alqadir 08-30-2004 01:56 AM

I got it to work, now my form.php files overwrites my newthread.
What I did was in the forumdisplay file I redirected the newthread commnd to point to filesCommand.php and in the redirection sent the current forum number. In the filesCommand.php I created multiple global arrays which stored command forum families for thread posting. I then did a CASE compare to see which form.php file should be called. Along with the form.php call I also sent the forum number and a series of on/off commands which enable and disable certain questions. This allows me to have a few generic form.php which are customized during call.

The only draw back I have right now is changing the number and type of questions since an external file handles this, so all you really need is one form.php that can customize itself during call.
If anyone is interested in the alterations I have made email me. I have a word document which highlighted all my edits. I have not put my comments in yet, but when I do I will post a link.

Thanks for all you help guys.

PKRWUD 08-30-2004 01:52 PM

Quote:

Originally Posted by SnowBot
$navbar Is already there but i dont get the navbar when the forum is submitted and goes to the "Thank You Message"

I get the navbar when you are answering the questions but not once you submit and get redirected to the "thanks" message.


My bad, add $navbar directly underneath $header in the STANDARD_ERROR template.

:)

PKRWUD 08-30-2004 01:54 PM

Quote:

Originally Posted by oldford
OK, finally got this to work. Here's the code if you want to have the "New Thread" button redirect to different forms for different forums. Don't forget to end with the correct number of </if> end tags to close out the code.

HTML Code:

<a href="<if condition="$foruminfo['forumid'] == 123">form123.php<else /><if condition="$foruminfo['forumid'] == 456">form456.php<else />newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]</if></if>">
PKRWUD, it looks like the <elseif> code isn't supported by VB so you need to nest <if> instead. At least according to the manual:
http://www.vbulletin.com/docs/html/m...e_conditionals


I am still very much a rookie at all this, but I can rebuild carburetors in my sleep. lol. Thanks for posting your findings!!!

Take care,
~Chris

PKRWUD 08-30-2004 01:59 PM

Erwin-
I have discovered one small problem. If there is an apostrophe in the thread title, I get a MySQL error.

Erwin 08-31-2004 03:14 AM

Quote:

Originally Posted by dndog
Erwin,

I'm trying to make a form where someone can type the name of a website in $answer2 and then paste the link in $answer1 and it will link the word in the post. Here is my edited formanswers template:

PHP Code:

$formtitle
$bbuserinfo
[username]
Link to Site:
 
<
A HREF="$answer1">$answer2</a

Here is what happens:
PHP Code:

Link to Site
 
&lt;A HREF=&quot;game name&quot;&gt;http://www.dndonlinegames.com&lt;/a&gt; 

How can I make this work? Thanks!

Replace:

HTML Code:

<A HREF="$answer1">$answer2</a>
With:

The [url ] bbtag:

HTML Code:

[url="$answer1" ] $answer2 [/url ]
Remove the space in the url tags, but keep the space around $answer2.

Erwin 08-31-2004 03:16 AM

Quote:

Originally Posted by PKRWUD
Erwin-
I have discovered one small problem. If there is an apostrophe in the thread title, I get a MySQL error.

Just add a \ in FRONT of any apostrophes you want to use IN the quotation marks.

PKRWUD 08-31-2004 09:42 AM

Quote:

Originally Posted by Erwin
Just add a \ in FRONT of any apostrophes you want to use IN the quotation marks.


I'm sorry, I wasn't specific enough. When ever someone fills out the form on my site, if they include an apostrophe in the box that becomes $formtitle (ie: I'm having car trouble), when they try to complete the form, they get the following error message:

Database error in vBulletin 3.0.0:

Invalid SQL:
INSERT INTO thread(title, lastpost, forumid, open, replycount,
postusername, postuserid, lastposter, dateline, iconid, visible, attach)
VALUES
('PKRWUD 'test'', 1093876723, 53,
1, 0, 'PKRWUD', 94,
'PKRWUD', 1093876723, 0, 1,
0)

mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'test'', 1093876723, 53,


mysql error number: 1064

Erwin 08-31-2004 12:19 PM

Replace:

'$formtitle'

in the query with:

'" . addslashes($formtitle) . "'

PKRWUD 08-31-2004 01:16 PM

Quote:

Originally Posted by Erwin
Replace:

'$formtitle'

in the query with:

'" . addslashes($formtitle) . "'


I'm not terribly bright when it comes to this stuff, and didn't realize that I had to make that change in 3 queries in order for it to work, but I figured it out in a couple minutes. Thanks for taking the time to help! You ROCK!

Thanks again!

Take care,
~Chris

alqadir 08-31-2004 06:51 PM

Newbie question: why do we have three files here? Can't everything be put in the form.php file?

WAR 08-31-2004 07:03 PM

The second file contains example templates thatyou will need to create in addition to the generic form.php file

dndog 08-31-2004 08:56 PM

Quote:

Originally Posted by Erwin
Replace:

HTML Code:

<A HREF="$answer1">$answer2</a>
With:

The [url ] bbtag:

HTML Code:

[url="$answer1" ] $answer2 [/url ]
Remove the space in the url tags, but keep the space around $answer2.

I tried doing that, but the url came out like this:

Yahoo

kall 09-01-2004 02:08 AM

Beautiful.

One minor typo in installation.txt tho..
Quote:

3. Upload form.php

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

y2krazy 09-01-2004 11:21 AM

Is there a way to make a form that is created to be required by any new registration before they can do anything else? Such as a form that posts an introduction thread in a specified forum when someone registers, and it will be a requirement before said new member can do anything on the entire forum(almost like a "second" registration page). Maybe a re-direct once the registration goes through or something to the form before anything else can take place. Let me know if this can be done, or is even possible. Thanks!

Abe1 09-03-2004 12:18 AM

Thanks for the hack. I made 14 forms for my site. All leading to new threads.

I got 2 problems now. One, the posts don't count. Two, the posts don't get searched.

I fixed number one by my self.

find:
PHP Code:

$forum[forumid] = $formforumid

add before:
PHP Code:

                $DB_site->query("
                                UPDATE " 
TABLE_PREFIX "user
                                SET posts = posts + 1
                                WHERE userid = 
$bbuserinfo[userid]
                        "
); 

find:
PHP Code:

$forum[forumid] = $formreplyforumid

add before:
PHP Code:

                $DB_site->query("
                                UPDATE " 
TABLE_PREFIX "user
                                SET posts = posts + 1
                                WHERE userid = 
$bbuserinfo[userid]
                        "
); 

For the search problem, I couldn't come up with anything yet. Maybe someone else can.

dndog 09-03-2004 08:15 PM

Does anybody know how to fix my url problem? It outputs a url like this:

How can I get rid of the &quot?

RMS-Chef 09-04-2004 03:43 AM

Anyone know if it would be possible to add something like a drop down menu that could list of admin defined forums in which the form would be submitted as a new thread?

I am helping a friend with writing style forum so he has many categories/forums to submit writing. Rather than creating 20 forms that are identical other than the forum they would be submitting to, it would be great to have one form with the user defining which forum to send it to as a new thread.

RMS-Chef 09-04-2004 12:50 PM

Quote:

Originally Posted by oldford
OK, finally got this to work. Here's the code if you want to have the "New Thread" button redirect to different forms for different forums. Don't forget to end with the correct number of </if> end tags to close out the code.

HTML Code:

<a href="<if condition="$foruminfo['forumid'] == 123">form123.php<else /><if condition="$foruminfo['forumid'] == 456">form456.php<else />newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]</if></if>">
PKRWUD, it looks like the <elseif> code isn't supported by VB so you need to nest <if> instead. At least according to the manual:
http://www.vbulletin.com/docs/html/m...e_conditionals

This works great.
I am not sure if anyone else would do it this way but I have a lot of different forms and instead of typing the name of each form file name such as:
Code:

<if condition="$foruminfo['forumid'] == 123">form123.php<else />
I instead am using:
Code:

<if condition="$foruminfo['forumid'] == 123">form$foruminfo[forumid].php<else />
Means one less thing to edit when nesting a bunch of these if/else.

This brings me to another question, would it be possible to just have one if statement and use an array of some sort like:
Code:

<if condition="$foruminfo['forumid'] == 123,124,125,126">form$foruminfo[forumid].php<else />
I know this does not work but could it be done? I am a complete code newb so I wouldn't have the first clue if it's possible or what's involved but that would cut down on huge nesting.

AmbitiousLemon 09-05-2004 12:10 AM

Erwin I would also like to add my vote for allowing attachments in the form should it be used to create a new thread. You mentioned earlier that this might be hard while simply uploading an image to the db wouldn't be as hard. Could you give us some example code on how to allow someone to uplaod to db and then show the template mod that would be needed to display that image in the thread?

I like a previous poster am trying to use this for a classifieds section.

PcGamer 09-05-2004 05:56 PM

Nice modification. I have it working well on my site :)

I use my forms to just send an email to my address. Is it possible for it to send to multiple addresses? If so how?


Thanks!

Abe1 09-05-2004 07:05 PM

Quote:

Originally Posted by PcGamer
Nice modification. I have it working well on my site :)

I use my forms to just send an email to my address. Is it possible for it to send to multiple addresses? If so how?


Thanks!

Sure,

Look for this:
PHP Code:

    vbmail($formemailaddress$formtitle$formsend); 

copy this line over and over for as many email addreess you want the email going to. Change
PHP Code:

$formemailaddress 

to a different email on each line.




Anyone figured out yet how to make a thread made by these forms search able?

y2krazy 09-06-2004 01:57 AM

Quote:

Originally Posted by y2krazy
Is there a way to make a form that is created to be required by any new registration before they can do anything else? Such as a form that posts an introduction thread in a specified forum when someone registers, and it will be a requirement before said new member can do anything on the entire forum(almost like a "second" registration page). Maybe a re-direct once the registration goes through or something to the form before anything else can take place. Let me know if this can be done, or is even possible. Thanks!

No one has any idea how this can be done? Would be great if someone could help me out... :)

Abe1 09-08-2004 05:18 PM

Quote:

Originally Posted by Abe1
Thanks for the hack. I made 14 forms for my site. All leading to new threads.

I got 2 problems now. One, the posts don't count. Two, the posts don't get searched.

I fixed number one by my self.

find:
PHP Code:

$forum[forumid] = $formforumid

add before:
PHP Code:

                $DB_site->query("
                                UPDATE " 
TABLE_PREFIX "user
                                SET posts = posts + 1
                                WHERE userid = 
$bbuserinfo[userid]
                        "
); 

find:
PHP Code:

$forum[forumid] = $formreplyforumid

add before:
PHP Code:

                $DB_site->query("
                                UPDATE " 
TABLE_PREFIX "user
                                SET posts = posts + 1
                                WHERE userid = 
$bbuserinfo[userid]
                        "
); 

For the search problem, I couldn't come up with anything yet. Maybe someone else can.

I Just fixed a MAJOR bug in this. If you used this, you MUST fix and run 'update user post count' in you acp. ALL users post count were going up evey time one person would use the form.

Michael2 09-11-2004 02:24 PM

This is a long thread so I'm sorry if these questions have been asked, I skimmed through it but didn't see the answers...

What would I need to do to get the thread title to be the answer from the first question? I'm using it for recipes, the first question is the recipe name, I want that to be the thread title.

Is there any way to use BB code? When I try putting it in the formanswers template I get an error when trying to save it. I want the questions to be in bold so that they stand out from the answers.

This is an awesome hack, thanks!

dndog 09-11-2004 03:35 PM

Quote:

Originally Posted by Erwin
Replace:

HTML Code:

<A HREF="$answer1">$answer2</a>
With:

The [url ] bbtag:

HTML Code:

[url="$answer1" ] $answer2 [/url ]
Remove the space in the url tags, but keep the space around $answer2.

I tried doing that, but the url came out like this:

http://&quot/;www.yahoo.com&quot;

Please let me know what I Can do to fix this...

wrongful 09-12-2004 01:26 PM

Does anyone have any idea how I can add a flood check to this?

Abe1 09-12-2004 02:37 PM

Quote:

Originally Posted by Michael2
What would I need to do to get the thread title to be the answer from the first question? I'm using it for recipes, the first question is the recipe name, I want that to be the thread title.

This should do to:
Find
PHP Code:

'".addslashes(htmlspecialchars($bbuserinfo[username]))." $formtitle'

E=Replace with:
PHP Code:

'$answer1'

Repeat this step as meny times as you can. I think it's about 5 or 6 times.
Quote:

Originally Posted by Michael2
Is there any way to use BB code? When I try putting it in the formanswers template I get an error when trying to save it. I want the questions to be in bold so that they stand out from the answers.

You can you BB code in the form_answer. Just make sur there is a space right before the '[' of the BB code if you are putting it right after a varible.
Quote:

Originally Posted by Michael2
This is an awesome hack, thanks!

Agreed.

Also, make sure you use my hack (look a few posts earlier) if you want the form to count as a post.

Ymeaga1n 09-12-2004 08:35 PM

Erwin it appears you have some extra code at the bottom of the form template that throws it off

PHP Code:

<p align="center">
<
input type="submit" value="Submit" name="submit" style="font-family: Verdana; font-size: 10pt" class="button"
<
input type="reset" value="Reset" name="reset" style="font-family: Verdana; font-size: 10pt" class="button">
</
p></td></tr>
</
table>
</
td>
</
tr>
</
table>

</
form>

$footer
</body>
</
html

the extra </td></tr></table> was throwing off how my page looked on the bottom because it was closing my table speficed in my header template. Hope you have a chance to edit it.

y2krazy 09-12-2004 11:34 PM

Quote:

Originally Posted by y2krazy
Is there a way to make a form that is created to be required by any new registration before they can do anything else? Such as a form that posts an introduction thread in a specified forum when someone registers, and it will be a requirement before said new member can do anything on the entire forum(almost like a "second" registration page). Maybe a re-direct once the registration goes through or something to the form before anything else can take place. Let me know if this can be done, or is even possible. Thanks!

Still looking for some help here guys. A simple yes or no will do... ;)

Abe1 09-13-2004 06:30 PM

Quote:

Originally Posted by y2krazy
Still looking for some help here guys. A simple yes or no will do... ;)

There is a way. But, it would take too long to explain. Basicly, make new users only see a link to the form. And all new users need one post and they change groups.

y2krazy 09-14-2004 04:17 PM

Quote:

Originally Posted by Abe1
There is a way. But, it would take too long to explain. Basicly, make new users only see a link to the form. And all new users need one post and they change groups.

Now, if only I had the time to do that... ;)

I can see it's not difficult, but I just need the time for it. I could just add an if/else statement so that they see a huge link to the form if they have < 1 post(if conditional), and if they have done the form, then they will see the normal forums view(else conditional). Thanks for the tip! ^^

Amavisca 09-16-2004 03:32 PM

Can I use this hack with the Article hack? I just want people to post articles in a specific format. How can I do that? Thanks a lot

mtha 09-19-2004 07:55 AM

Line 250 need to be fixed.

switch between lastposter and lastthread

change

PHP Code:

    if ($formreply == "1") {
     
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$formreplythreadid','".addslashes(htmlspecialchars($bbuserinfo[username])).$formtitle','".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($bbuserinfo['username']) . $formtitle',
                              lastthread = '"
.addslashes(htmlspecialchars($bbuserinfo[username]))."',
                              lastthreadid = 
$formreplythreadid
                              WHERE forumid = 
$formreplyforumid
                         "
);
 
$forum[forumid] = $formreplyforumid;
     } 

to

PHP Code:

    if ($formreply == "1") {
      
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$formreplythreadid','".addslashes(htmlspecialchars($bbuserinfo[username])).$formtitle','".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($bbuserinfo['username']) . "',
                                lastthread = '"
.addslashes(htmlspecialchars($bbuserinfo[username])).$formtitle',
                                lastthreadid = 
$formreplythreadid
                                WHERE forumid = 
$formreplyforumid
                        "
);
$forum[forumid] = $formreplyforumid;
    } 


Erwin 09-19-2004 11:48 PM

Fixed my ZIP mtha - thanks.

Marcus Lau 09-21-2004 05:41 PM

Alright, PTL!!! That is awesome!!!! Thank God for you!!!

venomx 09-22-2004 03:15 AM

I have it set to PM me when someone fills out the form. Works great but something is wrong because I do not get an email saying I have a new PM....


All times are GMT. The time now is 11:56 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.01907 seconds
  • Memory Usage 1,939KB
  • 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
  • (3)bbcode_code_printable
  • (9)bbcode_html_printable
  • (19)bbcode_php_printable
  • (23)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (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