View Full Version : Create New Thread with Cron
bananalive
02-17-2009, 04:09 PM
Is it possible to create a new thread with cron scheduled tasks?
Lynne
02-18-2009, 12:47 AM
Sure, if you write the code to do it - almost anything is possible. Do I have that code handy? No. You would have to go search that out yourself. There are mods that create threads, so you can start with the code there.
Dismounted
02-18-2009, 05:56 AM
You should be creating threads with the ThreadPost Data Manager. In addition to articles, there is some documentation in the manual: Data Managers (http://www.vbulletin.com/docs/html/data_managers).
bananalive
02-18-2009, 08:03 AM
I tried using datamanager to no avail :(
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################
require_once(DIR . '/includes/functions_misc.php');
global $vbulletin, $botpermissons, $vbphrase;
$userinfo = fetch_userinfo(1);
$threadinfo = array();
$foruminfo = fetch_foruminfo(10);
$threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_SILENT);
$threaddm->set_info('forum', $foruminfo);
$threaddm->set('forumid', $forumid);
$threaddm->set('userid', 1);
$threaddm->set('title', 'Title');
$threaddm->set('pagetext', 'Test thread create');
$threaddm->set('open', 1);
$threaddm->set('allowsmilie', 1);
$threaddm->set('visible', 1);
$threaddm->pre_save();
$threadid = $threaddm->save();
unset($threaddm);
log_cron_action('', $nextitem, 1);
?>
ragtek
02-18-2009, 08:20 AM
what error are you getting?
i think $userinfo = fetch_userinfo(1); isn't possible, try this:
$postuser = 1;
$userinfo = fetch_userinfo($postuser);
also with fetch_foruminfo
Dismounted
02-18-2009, 08:24 AM
Instead of using a silent error type, use one of the others so you can see what goes wrong.
bananalive
02-18-2009, 09:12 AM
i think $userinfo = fetch_userinfo(1); isn't possible, try this:
$postuser = 1;
$userinfo = fetch_userinfo($postuser);
also with fetch_foruminfo
Cheers that worked :D
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.