OK. In case anyone else needs this code....
This worked for me with vBullentin version 3.5.4
The new thread was created successfully -even when I was not loggin in.
<?php
require_once('./global.php');
require_once('./includes/functions_newpost.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');
require_once('./includes/functions_databuild.php');
$forumid = 19;
$userid = 1;
$title = 'The first autopost!';
$pagetext = 'More details here.';
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$foruminfo = fetch_foruminfo($forumid);
$threaddm->set_info('forum', $foruminfo);
$threaddm->set('forumid', $forumid);
$threaddm->set('userid', $userid);
//$threaddm->set('user', 'SGD DESIGNS');
$threaddm->set('title', $title);
$threaddm->set('pagetext', $pagetext);
$threaddm->set('allowsmilie', 1);
$threaddm->set('visible', 1);
$threaddm->set('dateline', TIMENOW);
$threaddm->save();
?>
|