Log in

View Full Version : Adding a new field to the forum table


amykhar
06-12-2005, 06:24 PM
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:


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:


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
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:


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:


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
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
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.