Ok I had this working, but am now trying to implement on a new machine running a version of 3.0.7 and php5. I am getting an odd error,
Fatal error: Call to undefined method stdClass::query_first() in /usr/local/www/htdocs/bbs/includes/functions.php on line 938
Here is my code. As far as I can tell everything is being included fine, no errors there.
PHP Code:
# Do forum stuff
chdir('/usr/local/www/htdocs/bbs');
// Load vB-Backend
require('./global.php');
require('./includes/functions_newpost.php');
if ($_POST[news_user_id] == 0 || !$_POST[news_user_id]) {
$userid = 1;
} else {
$userid = 1;
}
//$userid = $_POST[news_user_id]; // The user creating the thread
$forumid = 120; // The forum where the thread should be posted
// Get forum & user info
$foruminfo = fetch_foruminfo($forumid);
$bbuserinfo = fetch_userinfo($userid);
print_r($bbuserinfo);
// Setup the thread
$post[title] = $title;
$post[message] = $article;
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
$post[emailupdate] = 9999;
// build the thread
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);
// Errors?
if (sizeof($errors) > 0) {
?>There have been errors. <?=$errors?><?
print_r($errors);
die('errors');
}
$ThreadID = $post['threadid'];
$PostID = $post['postid'];
print ("the threadid is $ThreadID and the postid is $PostID");