vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Adding/accessing a forum database field (https://vborg.vbsupport.ru/showthread.php?t=160544)

weinstoc 10-19-2007 12:58 AM

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

Eikinskjaldi 10-19-2007 06:06 AM

Quote:

Originally Posted by weinstoc (Post 1363438)
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.

weinstoc 10-19-2007 10:13 AM

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

Eikinskjaldi 10-19-2007 10:41 PM

Quote:

Originally Posted by weinstoc (Post 1363652)
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.

weinstoc 10-20-2007 12:56 AM

Quote:

Originally Posted by Eikinskjaldi (Post 1363986)
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

weinstoc 10-21-2007 02:42 AM

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.


All times are GMT. The time now is 12:39 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00964 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete