[HOW TO] Add custom fields to new threads
by
28 Apr 2006
Rating: (1 vote
- 5.00 average)
Ok - this is my first submitted 'how to' and is the result of me wanting to add a couple of new fields to my new threads. A quick search on here showed me a couple of people asking the same but no conclusive answers (there were a couple of threads with 'typos') so here is my code as is. It works for me anyway! 1. To add the fields to the thread table in the database: Go into admincp and down to the bottom. Select Execute SQL Query and then add your fields as follows: Code:
ALTER TABLE table ADD ( var VARCHAR(10) not null default '' ) 2. Add the fields to the newthread template in admincp / style manager Find Code:
<if condition="$show['misc_options']"> Code:
<div style="padding:$stylevar[formspacer]px"> <div> <input type="text" class="bginput" size="10" name="var" value="" id="var" tabindex="1" /> $vbphrase[var_name]</div> Code:
<fieldset class="fieldset"> <legend>$vbphrase[your_phrase]</legend> above code in here </fieldset> newpost_process Code:
if ($type == 'thread') { $dataman->setr('var', $post['var']); } Code:
$vbulletin->input->clean_array_gpc('p', array('var' => TYPE_STR)); $newpost['var'] =& $vbulletin->GPC['var']; Code:
$this->validfields['var'] = array(TYPE_STR, REQ_NO); I hope this helps - took me a while to get it sorted (and I did find help on here along the way) but this is the completed process. [EDITED: corrected an inevitable type in the SQL query ] |
Similar Mods
Miscellaneous Hacks Custom Field Columns: Display Custom Fields in Two Columns on Memberlist Search | vBulletin 3.7 Add-ons |