Register Members List Search Today's Posts Mark Forums Read

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

UK
by jaybolt jaybolt is offline 27 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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and above that add:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 :


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

newthread_post_start


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

threadfpdata_start


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 ]

Last edited by jaybolt; 28 Apr 2006 at 08:01..
Views: 17640
Reply With Quote
Comments
  #2  
Old 09 Oct 2006, 11:04
ibuddy ibuddy is offline
 
Join Date: May 2006
can you give me a screen shot of your edit plugin screen

Last edited by ibuddy; 09 Oct 2006 at 11:25.
Reply With Quote
  #3  
Old 20 Feb 2007, 16:18
delaen1 delaen1 is offline
 
Join Date: Nov 2006
How do you access it once it's in there?
Reply With Quote
  #4  
Old 01 Apr 2007, 13:16
dfe dfe is offline
 
Join Date: Oct 2006
Is it possible to do this, but then to only have it appear in a single forum, with subforums?
Reply With Quote
  #5  
Old 15 May 2007, 09:30
TMS_Hon TMS_Hon is offline
 
Join Date: Apr 2007
i used the hack, but the data is not getting inserted into the db... has anyone used this successfully... help
kamal
Reply With Quote
  #6  
Old 21 May 2007, 06:55
sonichero sonichero is offline
 
Join Date: Jan 2007
Originally Posted by dfe View Post
Is it possible to do this, but then to only have it appear in a single forum, with subforums?
Per style only. So, copy your style, put as default for that forum and only make the template edits there.

Thanks BTW.
Reply With Quote
  #7  
Old 21 Jun 2007, 07:01
SoftDux SoftDux is offline
 
Join Date: May 2007
Where can I see this in action?

Where can I see this in action?

Last edited by SoftDux; 21 Jun 2007 at 07:19. Reason: Automerged Doublepost
Reply With Quote
  #8  
Old 09 Aug 2007, 10:10
patrickb patrickb is offline
 
Join Date: Jun 2007
Could this also be used to add custom fields to forums?

Thanks
Reply With Quote
  #9  
Old 19 Aug 2007, 23:51
FatalBreeze FatalBreeze is offline
 
Join Date: Apr 2004
Real name: Aviad
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?
Reply With Quote
  #10  
Old 17 Oct 2007, 11:19
wolfe wolfe is offline
 
Join Date: Jan 2002
great article but its not inserting any data into the database using vb3.6.8 ? any ideas.
__________________
Thanks

Last edited by wolfe; 17 Oct 2007 at 12:02.
Reply With Quote
  #11  
Old 26 Oct 2007, 23:43
Lionel Lionel is offline
 
Join Date: Dec 2001
Real name: Lionel
Originally Posted by FatalBreeze View Post
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?
I'd like to know that also..

solution is in threadadmin_update ....

Last edited by Lionel; 27 Oct 2007 at 00:09.
Reply With Quote
  #12  
Old 02 Nov 2007, 22:01
brandondrury brandondrury is offline
 
Join Date: Oct 2005
great article but its not inserting any data into the database using vb3.6.8 ? any ideas.
Same here.

Brandon
__________________
Home Recording Forum

Brandon
Reply With Quote
  #13  
Old 04 Nov 2007, 15:34
fly fly is offline
 
Join Date: Oct 2003
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.
Reply With Quote
  #14  
Old 08 Nov 2007, 09:04
Jelmertjee Jelmertjee is offline
 
Join Date: Oct 2006
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.
__________________
EnjoyCG : free CG tutorials & community

Last edited by Jelmertjee; 08 Nov 2007 at 09:13.
Reply With Quote
  #15  
Old 08 Nov 2007, 09:12
Lionel Lionel is offline
 
Join Date: Dec 2001
Real name: Lionel
I did not have to do any additional edits on 3.68 patch level 2
Reply With Quote
Reply

Similar Article
Article Author Type Replies Last Post
Miscellaneous Hacks Custom Field Columns: Display Custom Fields in Two Columns on Memberlist Search calorie vBulletin 3.7 Add-ons 5 05 Aug 2008 09:50



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 09:29.

Layout Options | Width: Wide Color: