Quote:
Originally Posted by Dismounted
When you call the "save" method of the Post DM, you will receive that post's ID.
|
PHP Code:
require_once('global.php');
require_once('includes/class_dm.php');
require_once('includes/class_dm_threadpost.php');
require_once('includes/functions_databuild.php');
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$forumid = 12;
$title = $charNames . $txtttl . $charClass;
$pagetext = $txtbody;
$foruminfo = fetch_foruminfo($forumid);
$threaddm->set_info('forum', $foruminfo);
$forum_id = (int)$forum_id;
$pagetext = (string)strip_tags($pagetext);
$title = (string)strip_tags($title);
$threaddm->set('forumid', $foruminfo['forumid']);
$threaddm->set('userid', 1096);
$threaddm->set('title', $title);
$threaddm->set('pagetext', $pagetext);
$threaddm->set('allowsmilie', 1);
$threaddm->set('visible', 1);
$threaddm->set('dateline', TIMENOW);
$threaddm->pre_save();
if (count($threaddm->errors) > 0) {
print_r($threaddm->errors);
}
else {
$threaddm->save();
build_forum_counters($forum_id);
}
I used above code to create new thread.
Did you mean attach files after posting thread?!
But if i want to make links to attached files in the thread, i need to attach files before posting thread, or edit thread after attaching files !!!