vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Adding a new field to the forum table (https://vborg.vbsupport.ru/showthread.php?t=82971)

amykhar 06-12-2005 06:24 PM

Adding a new field to the forum table
 
I'm tearing my hair out on this one. I've got to be missing something.

I am adding a text field to the forum table. And, I need to have it editable in the admincp.

In the past, I would simply add the field to the database and then put in the code setting up the display of the field and the variable names. It would mirror the code for the forum description, which looks like this:

Code:

print_textarea_row($vbphrase['description'], 'forum[description]', $forum['description']);
So, my new text field would have a new column in the database called newfield (or whatever) and the code would look like:

Code:

print_textarea_row($vbphrase['newfield'], 'forum[newfield]', $forum['newfield']);
But, on my test site, it keeps telling me that newfield isn't a valid bitfield. Description, Link and other similar database fields are also not bitfields. They are not in the xml file.

So, what in heck am I missing? I've been plowing through the code to see if the forum description or link field are instantiated in any other file, and I'm not seeing anything.

Amy

Zachery 06-12-2005 06:45 PM

Quote:

Originally Posted by amykhar
I'm tearing my hair out on this one. I've got to be missing something.

I am adding a text field to the forum table. And, I need to have it editable in the admincp.

In the past, I would simply add the field to the database and then put in the code setting up the display of the field and the variable names. It would mirror the code for the forum description, which looks like this:

Code:

print_textarea_row($vbphrase['description'], 'forum[description]', $forum['description']);
So, my new text field would have a new column in the database called newfield (or whatever) and the code would look like:

Code:

print_textarea_row($vbphrase['newfield'], 'forum[newfield]', $forum['newfield']);
But, on my test site, it keeps telling me that newfield isn't a valid bitfield. Description, Link and other similar database fields are also not bitfields. They are not in the xml file.

So, what in heck am I missing? I've been plowing through the code to see if the forum description or link field are instantiated in any other file, and I'm not seeing anything.

Amy

You either need to add it to the forums dm class or add it on runtime

So you find for example $forumdata =& datamanager_init('Forum', $vbulletin, ERRTYPE_CP);

and add under
$forumdata->validfields['crap'] = array(TYPE_UINT, REQ_NO);

I think :D

That

amykhar 06-12-2005 08:30 PM

Thanks, Zach. It works. :)

{slight diversion off topic now: }

You know, when I worked in software development, we would have been fussed at if we wrote code with documentation like 3.5 beta. I don't mean manuals, I mean comments in the code. The old code had no comments, but at least it made more sense. This new stuff needs comments. It's not intuitive enough to do without them.

I don't know. Maybe I'm spoiled because every manager I ever worked for made us write readable comments in the code so that any moron could pick up a file and understand what's going on.

Amy

cirisme 06-13-2005 12:58 PM

Quote:

Originally Posted by amykhar
Thanks, Zach. It works. :)

{slight diversion off topic now: }

You know, when I worked in software development, we would have been fussed at if we wrote code with documentation like 3.5 beta. I don't mean manuals, I mean comments in the code. The old code had no comments, but at least it made more sense. This new stuff needs comments. It's not intuitive enough to do without them.

I don't know. Maybe I'm spoiled because every manager I ever worked for made us write readable comments in the code so that any moron could pick up a file and understand what's going on.

Amy

Quote:

The old code had no comments, but at least it made more sense. This new stuff needs comments. It's not intuitive enough to do without them.
I agree 110%. The code changed drastically, and now if you need to do something you need to lookup items in five different places.


All times are GMT. The time now is 05:54 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.01329 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
  • (4)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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