// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
require_once(DIR . '/includes/functions_newpost.php');
require_once(DIR . '/includes/functions_wysiwyg.php');
// ########################################################################
// ######################### Edit These ############################
// ########################################################################
$forumid = 20; // the ID of the forum the thread will be posted in
$closedforum = 60; // the ID of the forum the thread will be moved to when closed (if used)
$botuserid = 4772; //userid of poster
$botusername = "ShoutBox"; // username of poster
$title = " SHOUT BOX"; //Title of the thread
$iconid = 15; // id of the icon to be used.
$daystamp = date("l, F jS, Y"); // I used this in the thread title to specify the day
$threadtitle = $title;
// uncomment below if you want the date stamp to precede the title
//$threadtitle = "[".$daystamp."] ".$title;
$postmessage = "
[CENTER][SIZE=5][color=Red][b]Welcome to the daily Shout Box Thread.[/b][/color][/SIZE]
[/CENTER]
As a reminder, all forum rules still apply.
this thread will auto close @ midnight, and a new one will be auto created.
enjoy and have fun.
:dancenana:
";
// ########################################################################
// ########################################################################
// uncomment below if you'd like to move the previous threads created by botuserid to an archive forum.
//$vbulletin->db->query_write(" UPDATE " . TABLE_PREFIX . "thread SET forumid = $closedforum, open = 0 WHERE forumid = $forumid and postuserid = $botuserid ");
##### THIS creates the thread
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "thread (title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline, iconid, visible)
VALUES ('" . addslashes($threadtitle) . "', " . TIMENOW . ", $forumid, 1, 0, '$botusername', $botuserid, '$botusername', " . TIMENOW . ", $iconid, 1)");
$threadid = $vbulletin->db->insert_id();
### This creates the post
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "post (threadid, parentid, title, username, userid, dateline, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible)
VALUES ($threadid, 0, '" . addslashes($threadtitle) . "', '$botusername', $botuserid, " . TIMENOW . ", '" . addslashes($postmessage) . "', 1, 0, 0, $iconid, 1) ");
$firstpostid = $vbulletin->db->insert_id();
###links the post and thread
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "thread SET firstpostid = $firstpostid WHERE threadid = $threadid");
### updates forum stat
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "forum
SET replycount = replycount + 1,
threadcount = threadcount + 1,
lastpost = " . TIMENOW . ",
lastposter = '$botusername',
lastthread = '" . addslashes($threadtitle) . "',
lastthreadid = $threadid,
lasticonid = $iconid
WHERE forumid = $forumid
");