vBulletin Modifications

New Table/Query - proper plugin technique?

Welcome to vBHackers.com! - vBHackers Updates:

Go Back   vBulletin Modifications > General vBulletin Section > General vBulletin Support

Reply
 
LinkBack Thread Tools
Old 04-14-2006, 06:25 PM   #1
tgreer
Guest

Default New Table/Query - proper plugin technique?

I'm working on a plug-in that will require a new table, and associated queries.

I can do the SQL/PHP stuff, no problem. My question is, how can I make this table and these queries play in the vBulletin sandbox completely?

That is to say: I want my table/queries to participate fully in the vBulletin datastore/caching system. Certain query results should be available as part of the $vbulletin->options, etc.

Please let me know if this is a clear enough question.

What I'm trying to do is avoid doing $db->query in my plugins... my table should be cached, the information should be fetched and stored in the $vbulletin option already, 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].

Last edited by tgreer; 04-14-2006 at 06:39 PM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 04-15-2006, 06:40 AM   #2
vBulletin Guru
Arnoud's Avatar
Join Date: Nov 2004
Real Name: Arnoud Kuipers
Location: Europe, Flanders
Arnoud is on a distinguished road

Default

If you'd like to use the $vbulletin->userinfo[] and $bbuserinfo[] arrays you can simply add your extra field to the User table, which will be cached automaticly.

If you want to know how to add your own table to the datastore, I believe this howto explains it.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-15-2006, 08:59 AM   #3
vb.org @dministrator
Join Date: Apr 2006
Paul M is on a distinguished road

Default

If you just mean 1 or 2 user related fields then just add them to the user table. You can also add text fields to the usertextfield table (technically you can add fields to the userfield table as well, but I don't think it's recommended as it may break something). Alternativly, you can link your own table into the userinfo query (the one that gets and caches all a users information) via the 'fetch_userinfo_query' hook.

Last edited by Paul M; 04-15-2006 at 09:07 AM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-15-2006, 11:40 AM   #4
tgreer
Guest

Default

The "user" table was just an example... I didn't mean to misdirect everyone. Think instead "generic table" and "generic query".




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -3. The time now is 11:22 PM.


SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc. (Patent Pending)