The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Required object config for threads/posts
All-
Still relatively new to vB and have a question regarding exactly what is required when initializing/configuring your DM thread or post object prior to (pre)saving it to your DB/forum. Specifically, when conducting a search regarding this subject, one will see (good) examples such as this for the thread stuff: Code:
$forumid=324; $threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD); $foruminfo = fetch_foruminfo($forumid); ... $threaddm->set_info('forum', $foruminfo); $threaddm->setr('forumid', $forumid); ... Code:
$threadid = 421; $userid = 52; $postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD); $threadinfo = fetch_threadinfo($threadid); $foruminfo = fetch_foruminfo($forumid); ... $postdm->set_info('forum', $foruminfo); $postdm->set_info('thread', $threadinfo); $postdm->set('threadid', $threadid); $postdm->set('userid', $userid); ... I ask only out of curiosity. I tried both of these examples without retrieving any information (via the fetch_[thread|forum]info() calls) and by simply setting the correct thread/forum ID in the object's data the threads/posts in my test appeared to show up ok and function correctly. Surely though there was/is a reason for this fetch-n-set stuff, so I thought I'd ask. I'd prefer to "do it right" WRT the initialization/configuration of these objects, but mostly it's because curiosity often gets the better of me. Thanks! |
#2
|
|||
|
|||
I'm not any kind of authority on that stuff, but looking at the code for those classes there are cases where foruminfo fields other than the forumid are used (for instance it looks for a list of parent forums in one case). I think the idea of having a dm class is to hide the details (and therefore reduce dependencies), so that maybe if something is added in a future an update your code has less chance of breaking.
|
#3
|
|||
|
|||
Ok thank you for the feedback. I'll include them just to CMA...kinda thinking along the same lines...
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|