PDA

View Full Version : Data Managers (Thread & Post)


01satkins
02-08-2010, 09:29 PM
Hi,

I need to insert some posts / edit some threads from an external tool.
I've looked around and the only 'documentation' from vbulletin seems to be names of datamanagers and an example for the users mgr.

I found an article on here about inserting posts, it doesn't seem to be particularly 'error sensitive' but at least it works. What I need now is to be able to edit a thread to change is prefix, and possibly move the thread somewhere else.

I have no idea how to actually edit something with the datamanager, and all the samples and examples i've found seem to be related to adding things, so any help on this matter would be appreciated.

I would also be interested to know how (if?) i can use the vbulletin functions for locaitng a thread from a forum URL like the merge threads option does.

Thanks

(Here's the code i'm using for adding a post, any improvements to it would be appreciated too, thanks)
require_once('global.php');
require_once('includes/class_dm.php');
require_once('includes/class_dm_threadpost.php');
require_once('includes/functions_databuild.php');

$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);

$postthreadid = '54338';
$postuserid = '1565';
$postpagetext = 'this is a test post';

$threadinfo = fetch_threadinfo($postthreadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);

$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set('threadid', $postthreadid);
$postdm->set('userid', $postuserid);
$postdm->set('pagetext', $postpagetext);
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', TIMENOW);
$postdm->save();
unset($postdm);

build_forum_counters($threadinfo['forumid']);

--------------- Added 1265757204 at 1265757204 ---------------

i've got most of it figured out now, thanks anyway