Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[HOW TO] Add custom fields to new threads
jaybolt
Join Date: Jun 2004
Posts: 20

 

UK
Show Printable Version Email this Page Subscription
jaybolt jaybolt is offline 04-26-2006, 10:00 PM

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 ''
)
Where table is the name of your vb thread table (eg vb_thread) and var is the name of the field you are adding.

2. Add the fields to the newthread template in admincp / style manager

Find
Code:
<if condition="$show['misc_options']">
and above that add:

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>
Again, var is the name of the field and the same as in the previous SQL Query. You can smarten this up further using the fieldset tags and creating a custom vbphrase for the $vbphrase[your_phrase] part :

Code:
<fieldset class="fieldset">
<legend>$vbphrase[your_phrase]</legend>

above code in here

</fieldset>
3. Go to admincp / add new plug in and add the following three plugins (give them the same name so you recognise them later):

newpost_process

Code:
if ($type == 'thread')
{
    $dataman->setr('var', $post['var']);
}
newthread_post_start

Code:
$vbulletin->input->clean_array_gpc('p', array('var' => TYPE_STR));

$newpost['var'] =& $vbulletin->GPC['var'];
threadfpdata_start

Code:
$this->validfields['var'] = array(TYPE_STR, REQ_NO);
Once again, var is the name of the variable you have been using for your field name above.

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 ]
Reply With Quote
  #22  
Old 03-11-2008, 08:38 PM
sstalder sstalder is offline
 
Join Date: Dec 2007
Location: Ohio
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I wanted to make my field editable via edit post do you know what changes need to be made?
Reply With Quote
  #23  
Old 04-05-2008, 08:20 PM
sstalder sstalder is offline
 
Join Date: Dec 2007
Location: Ohio
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I figured out my question, if someone wants help pm me.
Reply With Quote
  #24  
Old 06-03-2008, 06:04 PM
thebigman87 thebigman87 is offline
 
Join Date: Oct 2007
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #25  
Old 01-04-2009, 10:18 PM
Medtech's Avatar
Medtech Medtech is offline
 
Join Date: Oct 2007
Posts: 310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

would be nice to make a modification out of this that can be installed with chief post.
Reply With Quote
  #26  
Old 02-04-2009, 12:04 AM
Twilkey's Avatar
Twilkey Twilkey is offline
 
Join Date: Oct 2006
Posts: 314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FYI, This works on 3.8
Reply With Quote
  #27  
Old 03-04-2012, 08:38 PM
0lly 0lly is offline
 
Join Date: Apr 2007
Location: UK
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #28  
Old 11-02-2012, 04:44 AM
Muhammad Rahman Muhammad Rahman is offline
 
Join Date: Jun 2012
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

VB4 please ...
Reply With Quote
  #29  
Old 10-31-2014, 01:38 PM
m7sen m7sen is offline
 
Join Date: Mar 2014
Posts: 153
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hello

how can i Add custom fields to new post
for
vb3.8.8
Reply With Quote
  #30  
Old 10-31-2014, 05:42 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by m7sen View Post
hello

how can i Add custom fields to new post
for
vb3.8.8
https://vborg.vbsupport.ru/showthrea...=profile+field
http://www.vbulletin.com/forum/forum...To-The-Postbit
Reply With Quote
  #31  
Old 11-01-2014, 07:55 PM
m7sen m7sen is offline
 
Join Date: Mar 2014
Posts: 153
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
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:
Subject to the rules and conditions of Management Forum 
If notposts will be always in the queue management approval 
Because Easy Forms mod add form not like post

I want to manage the deployment of forms and control over :down:
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:25 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04643 seconds
  • Memory Usage 2,313KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (7)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (3)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete