In my php application I got this function
Code:
require_once('./global.htm');
require_once('./includes/class_dm.htm');
require_once('./includes/class_dm_threadpost.htm');
function update_thread($title, $pagetext, $threadid) {
global $vbulletin;
$postdm =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$threadinfo = fetch_threadinfo($threadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
$postinfo = fetch_postinfo($threadinfo['firstpostid']);
$userinfo = fetch_userinfo($postinfo['userid']);
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set_info('post', $postinfo);
$postdm->set_info('user', $userinfo);
$postdm->set('title', $title);
$postdm->set('pagetext', $pagetext);
$postdm->pre_save();
if (count($postdm->errors) > 0) {
print_r($postdm->errors);
return FALSE;
} else {
print_r($postdm->errors);
echo $postdm->save();
return TRUE;
}
}
Function update_thread should find thread by its id and update title and pagetext of its first post. The problem is that at the end I am getting error "You did not specify a username for your post.". I would highly appreciate if you could help me to solve it or at least point me to the direction where I can find more samples how to use datamanager (it looks to be almost undocumented). Thank you.