Use the data manger....
If its a post for an existing thread...
PHP Code:
$postdm =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$timenow = TIMENOW ;
$threadinfo = fetch_threadinfo($threadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set('threadid', $threadid);
$postdm->set('title', $title);
$postdm->set('userid', $userid);
$postdm->set('pagetext', $message);
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', $timenow);
if($postdm->errors){
There was an error
$postdm->errors is an array of errors
}
else{
$postdm->save();;
}
For new threads...
PHP Code:
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$foruminfo = fetch_foruminfo($forumid);
$threaddm->set_info('forum', $foruminfo);
$threaddm->set('forumid', $foruminfo['forumid']);
$threaddm->set('userid', $userid);
$threaddm->set('title', $title);
$threaddm->set('pagetext', $message);
$threaddm->set('allowsmilie', 0);
$threaddm->set('visible', 1);
$threaddm->set('dateline', TIMENOW);
if($threaddm->errors){
There was an error
$threaddm->errors is an array of errors
}
else{
$threaddm->save();
}