Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-19-2007, 12:58 AM
weinstoc weinstoc is offline
 
Join Date: Apr 2007
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Adding/accessing a forum database field

I'm new to VBulletin programming. I've been searching through what documentation I could find, but a lot of it is cryptic to me (probably because I don't understand the programming structure of VBulletin).

I would like to add a field to the forum database (say "X") and be able to access $foruminfo[X] in a conditional such (i.e., <if condition="$forum[X] == Something">
Do something
</if>

Can someone walk me through the best way to accomplish this?

Thanks,

Chuck
Reply With Quote
  #2  
Old 10-19-2007, 06:06 AM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by weinstoc View Post
I'm new to VBulletin programming. I've been searching through what documentation I could find, but a lot of it is cryptic to me (probably because I don't understand the programming structure of VBulletin).

I would like to add a field to the forum database (say "X") and be able to access $foruminfo[X] in a conditional such (i.e., <if condition="$forum[X] == Something">
Do something
</if>

Can someone walk me through the best way to accomplish this?

Thanks,

Chuck
You will have to alter the forum table with a mysql command

alter table forum add column column definition

the new field will be available in $foruminfo, which itself is set when you call global.php

Of course populating said field is another matter entirely.

I am not a big fan of modifying core vb tables. I always set up a second table in my own db which keys on forumid (or whatever key is appropriate), then store/fetch to that table as needed.
Reply With Quote
  #3  
Old 10-19-2007, 10:13 AM
weinstoc weinstoc is offline
 
Join Date: Apr 2007
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks. I actually tried that before I posted my question but putting $foruminfo[x] in the header text did not yield the populated value. Are other changes necessary?

I would prefer to create my own table but have no idea how to access the values from within the header text.

Thanks again,

Chuck
Reply With Quote
  #4  
Old 10-19-2007, 10:41 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by weinstoc View Post
Thanks. I actually tried that before I posted my question but putting $foruminfo[x] in the header text did not yield the populated value. Are other changes necessary?

I would prefer to create my own table but have no idea how to access the values from within the header text.

Thanks again,

Chuck
Did you try $foruminfo[field you know exists]


at any rate, $foruminfo needs to be scoped (a global$foruminfo) before the call to the template, and you have to use the correct syntax in the template, which may involve playing around with what is quoted.
Reply With Quote
  #5  
Old 10-20-2007, 12:56 AM
weinstoc weinstoc is offline
 
Join Date: Apr 2007
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Eikinskjaldi View Post
Did you try $foruminfo[field you know exists]


at any rate, $foruminfo needs to be scoped (a global$foruminfo) before the call to the template, and you have to use the correct syntax in the template, which may involve playing around with what is quoted.
Yes, I did. If I put $foruminfo[title_clean] for instance, it prints the title on the page. So I assume the globals $foruminfo must be there. But when I do $foruminfo[X] I get nothing.

Thanks for your help.

Best,

Chuck
Reply With Quote
  #6  
Old 10-21-2007, 02:42 AM
weinstoc weinstoc is offline
 
Join Date: Apr 2007
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

More information: if I force $usecache to false in fetch_foruminfo $foruminfo[X] exists. If I let it remain true $foruminfo[X] does not exist.

I'm not sure what this means though.

--------------- Added [DATE]1192938289[/DATE] at [TIME]1192938289[/TIME] ---------------

Immediately after typing the above I put together the name "forumcache" with the fact that one has to save the display order after an import. When I did that it cached the field and now I have what I need. I'm sorry for the wasted bandwidth.
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 11: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.05428 seconds
  • Memory Usage 2,210KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete