Check out my "
New Thread on User Banning" mod- it makes a new thread.
Here's a copy of the code to make a new thread... I got it off a tutorial somewhere around here that was for 3.x but the code is the same.
Code:
$bop5onban_fid = 2; //Forum ID for new thread
//Set new thread details...
$banthread =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$foruminfo = fetch_foruminfo($bop5onban_fid);
$threadinfo = array();
$forumid = $bop5onban_fid;
//Set some thread/post settings
$bop5postip = "127.0.0.1";
$bop5allowsmilie = '1';
$bop5visible = 1;
$banthread->set_info('forum', $foruminfo);
$banthread->set_info('thread', $threadinfo);
$banthread->setr('forumid', $forumid);
$banthread->setr('userid', $bop5onban_uid);
$banthread->setr('pagetext', $bop5onban_text);
$banthread->setr('title', $bop5onban_title);
$banthread->set('iconid', $vbulletin->options['bop5onban_icon']);
$banthread->set('allowsmilie', $bop5allowsmilie);
$banthread->set('visible', $bop5visible);
$banthread->set('ipaddress', $bop5postip);
$banthread->set('showsignature', $vbulletin->options['bop5onban_sig']);
$banthread->pre_save();
if(count($banthread->errors) < 1)
{
$threadid = $banthread->save();
unset($banthread);
build_thread_counters($banthread);
}
else
{
print "Error making new thread! " . $banthread->errors[0] . $banthread->errors[1] . $banthread->errors[2] ;
}
build_forum_counters($forumid);
// end make thread code