The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
which PHP file contains posting sql function?
Hi,
I have created additional fields in my editor and I would like to able to store those variables into database. However, I'm not quit familiar with VB yet and don't know which file contains the code for submitting the post bits to db. I have manually create three "columns" named "price", "orig_price" and "pct". Could someone show me where sql command is called during posting and when it pulls out to render in the template. thanks |
#2
|
||||
|
||||
I believe it would be: includes/functions_newpost.php
|
#3
|
|||
|
|||
thanks. I have the following code as a plugin which adds two extra input fields during new post. Stored in "price" and "saleprice", it also calculate the third value "pct".
I would like to store them into db with the thread of the postbits. Could you help me figure it out? Thanks Code:
$vbulletin->input->clean_array_gpc('p', array( 'saleprice' => TYPE_uinit, 'price' => TYPE_uinit)); $price = $vbulletin->GPC['price']; $saleprice = $vbulletin->GPC['saleprice']; vB_Template::preRegister('newthread', array('price' => $price, 'saleprice' => $saleprice)); $pct = intval((1-($vbulletin->GPC['saleprice'] / $vbulletin->GPC['price']))*100 ); $vbulletin->GPC['subject'] .= " for $".$vbulletin->GPC['saleprice'] .", {$pct}% off (orig.$" . $vbulletin->GPC['price'] . ")"; i see this Code:
function build_new_post($type = 'thread', $foruminfo, $threadinfo, $postinfo, &$post, &$errors) |
#4
|
|||
|
|||
In includes/class_dm_threadpost.php, around line 1515 is class vB_DataManager_ThreadFirstPost, if you scroll down you see a $validfields array which I believe are the columns from the thread table. If you scroll down further you see this:
PHP Code:
which is executed when one of those objects is created, so if you create a plugin using hook threadfpdata_start, you should be able to add your fields to the $validfields array. Then in build_new_post() in includes/functions_newpost.php, you can see the fields being set. So you should be able to create a plugin using hook newpost_process and something like: PHP Code:
(BTW, I haven't actually tried this). |
#5
|
|||
|
|||
Thanks very much..
How do I set the third variable "pct" which is the result of calculation from "price" and "saleprice"? since the three additional fields were done by another plugin, will this work? PHP Code:
|
#6
|
|||
|
|||
As long as the other plugin runs first. I guess it'll be easy enough to tell. If they were done in newthread.php before build_new_post() is called, you'll be OK.
--------------- Added [DATE]1311888277[/DATE] at [TIME]1311888277[/TIME] --------------- Where do you want to read them? Your other thread said postbit, but this is a thread thing and not a post thing. Anyway, it might be available already. In a template you could try {vb:raw thread.price}. |
#7
|
|||
|
|||
actually I want to display in vbadvanced template. Thanks
Quote:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|