Log in

View Full Version : Thread and Post creation help needed


trancetopia
11-06-2007, 07:16 PM
Hi everyone,

I need to write some custom code to create a thread then add a few posts to the thread that has been created. I've done some searching but haven't found what I need.

Does anyone have any code that will first create a thread then have code that I can put in a loop to create the posts?

Thanks,
Paul

--------------- Added 1194384945 at 1194384945 ---------------

ok forget my first question, how can I return the threadid created after executing the following?

// Backend Files
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');

// Setup Variables
$forumid = 22; // The forum id that you want the thread posted in
$postuserid = 1; // The Userid of the poster
$postusername = "ChUNk"; // The username of the poster
$title = "This just in: " . $username . " joins our Forums..."; // The thread title

// Don't change below this line

// Start thread create
$threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);

$username = htmlspecialchars_uni($username);
$allowsmilie = '1';
$visible = '1';
eval('$pagetext .= "sdsdsdsdsdsdsdsds sd s stest";');

// Insert thread
$threaddm->do_set('forumid', $forumid);
$threaddm->do_set('postuserid', $postuserid);
$threaddm->do_set('userid', $postuserid);
$threaddm->do_set('username', $postusername);
$threaddm->do_set('pagetext', $pagetext);
$threaddm->do_set('title', $title);
$threaddm->do_set('allowsmilie', $allowsmilie);
$threaddm->do_set('visible', $visible);
$tid = $threaddm->save();



Thanks