Create new thread via script vbulletin

1k Views Asked by At

I have a script to create new thread with via scritp in vbulletin

    // Create a new datamanager for posting 
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost'); 

// Set some variable and information 
$forumid = 87;                                                                  // The id of the forum we are posting to 
$userid = 2;
$_POST["title"] = $vinanghinguyen_title;
$_POST["content"] = $final_content;                                                                 // The user id of the person posting 
$title = $_POST["title"];                                           // The title of the thread 
$pagetext = $_POST["content"];                                      // The content of the thread 
$allowsmilie = '1';                                                             // Are we allowing smilies in our post 
$visible = '1';                                                                 // If the post visible (ie, moderated or not) 

// Parse, retrieve and process the information we need to post 
$foruminfo = fetch_foruminfo($forumid); 
$threadinfo = array(); 
$user = htmlspecialchars_uni( fetch_userinfo($userid) ); 

$threaddm->set_info('forum', $foruminfo); 
$threaddm->set_info('thread', $threadinfo); 
$threaddm->setr('forumid', $forumid); 
$threaddm->setr('userid', $userid); 
$threaddm->setr('pagetext', $pagetext); 
$threaddm->setr('title', $title); 
$threaddm->set('allowsmilie', $allowsmilie); 
$threaddm->set('visible', $visible); 
// Lets see what happens if we save the page 
$threaddm->pre_save(); 
if(count($threaddm->errors) < 1) { 
    // Basically if the page will save without errors then let do it for real this time 
    $threadid = $threaddm->save(); 
    unset($threaddm); 
} else { 
    // There was errors in the practice run, so lets display them 
    var_dump ($threaddm->errors); 
} 
/*======================================================================*\

It can create new thread with title, forumid, userid.....but it not insert tag. I want insert with this script. thank for help

0

There are 0 best solutions below