im building a mod and one of the features i need is for it to automatically make threads but i cant seem to get it to work this the code ive got atm ive taken it from the newthread.php file but it doesnt work or give me any information as to why.
PHP Code:
$result = $db->query_read_slave(
"SELECT * FROM " . TABLE_PREFIX . "mods WHERE id = " . intval($_REQUEST['id']));
$mod = $db->fetch_array($result);
// set arrays
$foruminfo = array();
$newpost = array();
$errors = array();
require_once(DIR . '/includes/functions_newpost.php');
//...
$foruminfo['forumid'] = 2;
$newpost['message'] = '[url=http://localhost:8888/forum/mods.php?do=view&id=' . $mod['id'] . ']Link to mod[/url]
' . $mod['description'];
$newpost['title'] = $mod['title'];
$newpost['username'] = $mod['username'];
$newpost['poststarttime'] = time();
$newpost['rating'] = 0;
// trick it
$tmp_id = $vbulletin->userinfo['userid'];
$vbulletin->userinfo['userid'] = $mod['userid'];
build_new_post('thread', $foruminfo, array(), array(), $newpost, $errors);
$vbulletin->userinfo['userid'] = $tmp_id;
print_r($errors);
anyone got any ideas?