Ok, going back to one of my mods I'm still working on
, it creates the thread perfectly fine, but what I want to do, is create a setting in the vBulletin Options, to where the admin would enter a userid, and it would create the thread under that user.
The code I'm currently using is:
PHP Code:
// START CREATING THE THREAD
// Check to see if create new thread is enabled
if ($vbulletin->options['usml_staffapp_createthread'] == 1)
{
// Make a new thread
require_once(DIR . '/includes/functions_newpost.php');
$forumid = intval($vbulletin->options['usml_staffapp_forumid']);
$user_id = $vbulletin->options['usml_staffapp_userthread'];
$username = $vbulletin->userinfo['username'];
$target_foruminfo = fetch_foruminfo($forumid);
$newpost = array(
'userid' => $user_id,
'username' => $username,
'message' => $message2,
'title' => 'Staff Application: ' . $vbulletin->GPC['username'],
'poststarttime' => time(),
'emailupdate' => 0
);
build_new_post('thread', $target_foruminfo, array(), array(), $newpost, $errors);
// Check to see if create a poll is enabled
//Poll Options
$pollpublic = ($vbulletin->options['usml_staffapp_pollpublic']);
$polloption[1] = ($vbulletin->options['usml_staffapp_polloption1']);
$polloption[2] = ($vbulletin->options['usml_staffapp_polloption2']);
// Check to see poll option 3 is turned on
if ($vbulletin->options['usml_staffapp_polloption3on'] == 1)
{
$polloption[3] = ($vbulletin->options['usml_staffapp_polloption3']);
}
// Check to see poll option 4 is turned on
if ($vbulletin->options['usml_staffapp_polloption4on'] == 1)
{
$polloption[4] = ($vbulletin->options['usml_staffapp_polloption4']);
}
if ($vbulletin->options['usml_staffapp_addpoll'] == 1)
{
// Make a poll
require_once(DIR . '/includes/functions_newpost.php');
$threadinfo = verify_id('thread', $newpost[threadid], 0, 1);
$polloptions = count($polloption);
$question = $posttitle;
$vbulletin->GPC['options'] = $polloption;
$counter = 0;
$optioncount = 0;
$badoption = '';
while ($counter++ < $polloptions)
{ // 0..Pollnum-1 we want, as arrays start with 0
if ($vbulletin->options['maxpolllength'] AND vbstrlen($vbulletin->GPC['options']["$counter"]) > $vbulletin->options['maxpolllength'])
{
$badoption .= iif($badoption, ', ') . $counter;
}
if (!empty($vbulletin->GPC['options']["$counter"]))
{
$optioncount++;
}
}
// Add the poll
$poll =& datamanager_init('Poll', $vbulletin, ERRTYPE_STANDARD);
$counter = 0;
while ($counter++ < $polloptions)
{
if ($vbulletin->GPC['options']["$counter"] != '')
{
$poll->set_option($vbulletin->GPC['options']["$counter"]);
}
}
$poll->set('question', $question);
$poll->set('dateline', TIMENOW);
$poll->set('active', '1');
$poll->set('public', $pollpublic);
$pollid = $poll->save();
//end create new poll
// update thread
$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->set('pollid', $pollid);
$threadman->save();
}
// Check if any errors during post
if (sizeof($errors) > 0)
{
// Post of new thread failed !
$error_info = construct_errors($errors);
//echo $error_info;
// do anything you want here - likely to redirect !
// ...
}
// Fix forums counters
build_forum_counters($forumid);
}
// END CREATING THE THREAD
And I keep looking at it, and keep getting confused as to what to change to what haha. So, some guidance would be appreciated