The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
So I have a page where a new thread is created via the following script.
Code:
// ################# start new thread ###############################
// Create a new datamanager for posting
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
// Set some variable and information
$forumid = 59;
// The user id of the person posting
$user = htmlspecialchars_uni( fetch_userinfo($userid) );
$title = $user['username'] . "'s " . $year . " " . $make . " " . $model . " [" . $color . "]"; // The title of the thread
$pagetext = addslashes("Testing mic check 1 2"); // 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();
$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);
}
// ################# end new thread###############################
I do not need information on how to extract data i just need the syntax to make a new post in an already existing thread. |
|
#2
|
|||
|
|||
|
It's similar to creating a thread but you need to create a 'Post' data manager. You could look at function build_new_post() in includes/functions_newpost.php to get an idea of which data to set.
|
|
#3
|
|||
|
|||
|
Thank you.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|