The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
how to add new fields in post page?
hi,
i was wondering how to add additional input fields during thread posting which allow user to fill those input fields? then store into variables and could be used for example add the variable values to thread title thread title + variables variable 1 = 100 <= input by the user variable 2 = 200 <= input by the user and calculate variable 3 = 100/200 = 0.5 based on the inputs, calculate the third value and in the final thread title will show something like this. 30 foot sail boat sale for $100, 50% off from it's original price thanks |
#2
|
|||
|
|||
You should just be able to edit the newthread template and put in the new fields where you want them, just make sure they're inside the <form> tags. Then create a plugin using hook newthread_post_start and do something like:
PHP Code:
(BTW, I haven't actually tried any of this code) |
#3
|
|||
|
|||
Thanks. Could you explain to me a little bit more on the 2nd part? "create a plugin using hook"
I'm new to vb. how do you pass from "form" to those variables? thanks for the helps |
#4
|
|||
|
|||
Quote:
- In the Hook Location drop-down menu, choose newthread_post_start - Enter a title so that later you'll remember what this plugin does - Enter the code in the big text area - Select the "Yes" radio button next to "Plugin is Active" - Press "Save" If you want to change it, go to Plugins & Products -> Plugin Manager and click on Edit next to the plugin you want to change. You can also disable it from that page. Quote:
|
#5
|
|||
|
|||
Quote:
thanks |
#6
|
|||
|
|||
If you add HTML to the template like this:
HTML Code:
<input type="text" name="price" value="{vb:raw price}"> <input type="text" name="saleprice" value="{vb:raw saleprice}"> PHP Code:
After that (in the same plugin) you can do whatever you want with $saleprice and $price. If you want to modify the title at that point, you can change $vbulletin->GPC['subject']. |
#7
|
|||
|
|||
I will try it out tonight when I go home...
Thanks for all the helps! --------------- Added [DATE]1311664092[/DATE] at [TIME]1311664092[/TIME] --------------- you're the man!!!! It's work beautifully. one more question, what are the "TYPE" options do we have? for example, if someone enter 99.99 and 30, the discount should be 33.33% should I use "double" instead of integer? thanks update: i figured it out. Thanks |
#8
|
|||
|
|||
one more question. What should I do if I want display those "variables" in one of the vbadvanced templates? Should I just change the hook file point to vbadvanced template and create another plugin with the same variable setting?
thanks |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|