Log in

View Full Version : New Table/Query - proper technique?


tgreer
04-14-2006, 08:55 PM
I'm working on a plug-in that will require a new table, and associated queries.

I want my table/queries to participate fully in the vBulletin datastore/caching system. I want to avoid using $db->query in my plugins... my table should be cached, the information should be fetched and stored in the proper $vbulletin arrray, and so on.

Let me give a totally contrived, ridiculous example:

I add the user_foo table to the database, with two fields, userid and foo.

I have a query that gets the "foo" value for particular userid (same userid as in the user table, this would be a "primary key" relationship, though I would maintain that relationship in code... I don't like adding fields/keys, altering core tables).

I'd like to store the value of "foo" for each user in $vbulletin->userinfo['foo'] and have it be available in templates as $bbuserinfo[foo].

What is the "canonical" way of doing this?