PDA

View Full Version : How to create a reply/post via API


Adan0s
06-13-2010, 03:21 PM
hey there,

i'm currently writing an importscript which gets old articles and news out of e107 and posts them as a new thread in a specific forum. works well, but I also want to import the old comments.
unfortunately i can't find a tutorial on the usage of the datamanager-api for creating replies.
is there any reference or am i lost?

Adan0s
06-14-2010, 07:53 PM
bump

DragonBlade
06-14-2010, 08:12 PM
require_once('./global.php');
require_once(DIR . '/includes/class_dm.php');
require_once(DIR . '/includes/class_dm_threadpost.php');


$threadid = 1;
$forumid = 1;
$threadinfo = fetch_threadinfo($threadid);
$foruminfo = fetch_foruminfo($forumid);
$text = 'Hello World';

$postdm =& datamanager_init('Post', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
$postdm->set_info('thread', $threadinfo);
$postdm->set_info('forum', $foruminfo);
$postdm->set('threadid', $threadid);
$postdm->set('userid', 1);
$postdm->set('pagetext', $text);
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', TIMENOW);
$postdm->save();




Its missing databuild but I assume you dont need this as you can easily update the counters when you finish importing.