[HOW TO] Add custom fields to new threads
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 ( 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"> Code:
<fieldset class="fieldset"> newpost_process Code:
if ($type == 'thread') Code:
$vbulletin->input->clean_array_gpc('p', array('var' => TYPE_STR)); 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 :) ] |
can you give me a screen shot of your edit plugin screen
|
How do you access it once it's in there?
|
Is it possible to do this, but then to only have it appear in a single forum, with subforums?
|
i used the hack, but the data is not getting inserted into the db... has anyone used this successfully... help
kamal |
Quote:
Thanks BTW. |
Where can I see this in action?
Where can I see this in action? |
Could this also be used to add custom fields to forums?
Thanks |
that's a great article!
But if i want to edit my newthread? and then change the value of 'var', how do i do it? |
great article but its not inserting any data into the database using vb3.6.8 ? any ideas.
|
Quote:
solution is in threadadmin_update .... |
Quote:
Brandon |
Shouldn't you be using 'set' rather than 'setr'? I remember Andreas telling me not to use setr, as it bypasses some vB checks. I'm no genius at the stuff, so please excuse me if I'm wrong.
|
it's working fine for me (tested on clean 3.6.8 pl2 install) although you need to do more edits to actually show the $var in the thread, it does get inserted into the database for sure. If it's not working make sure you have used the right table name.. and the same $var everywhere.. Thanks for the article jaybolt.
so, how would you use it in a thread? change a query in showthread.php and select the var, then put the $var into your showthread template wherever you want it. |
I did not have to do any additional edits on 3.68 patch level 2
|
so do you mean the "$var" was automatically added to the thread, without any edits, I guess you would need to change the template at least, and thought you would need to do more programming?!
So did anyone manage to implement this with the ability to edit threads as well? besides just creating them, like this is not very useful, often you just want to make some changes if you spot a mistake somewhere.. at least I do. |
how do i make it so i can edit the fields and update them because currently its updating blank fields
|
I'm also having difficulties inserting any data into the database using vb3.6.8.
Is there a specific "Hook_Location" that should be used for the plugins. I've tried "admin_index_main1", which was the default and "threaddata_postsave" - neither of which work. Thanks for your help. |
Quote:
(in the original post.) |
Quote:
It seems obvious when you know how! I used the bold words now and it works. Thanks |
If I wanted to make my field editable via edit post do you know what changes need to be made?
|
I figured out my question, if someone wants help pm me.
|
I trying to make this work on Vbulletin 3.7.0 and to a degree it's working.
It will Store the new field entry in MySQL, however I am having trouble in the process I need to perform in order to display it in either Threadbit or Postbit. I believe I need to edit forumdisplay and/or showthread in order to this. Can anyone help me on this? I just don't know where to start. Any Help what so ever will be very appreciated. |
would be nice to make a modification out of this that can be installed with chief post.;)
|
FYI, This works on 3.8
|
Great guide, I have it working fine :)
But, can anyone help me edit it so that the fields can be edited once they have been entered and submitted? Thanks. |
VB4 please ...
|
hello
how can i Add custom fields to new post for vb3.8.8 |
Quote:
http://www.vbulletin.com/forum/forum...To-The-Postbit |
Quote:
but what i want is Add custom fields to new Post Reply in Thread what i mean is user what to add new post in whatever Thread i want to disable message and user must Writing in the fields that i have added and show these fields in post like https://vborg.vbsupport.ru/showthread.php?p=1796575 but what is problem in this mod the mod add form not like post i cannt use other mod like disable users to post twice for 24 hours or this optoin in vbulletin PHP Code:
I want to manage the deployment of forms and control over :down: |
All times are GMT. The time now is 02:05 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|