vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Create New Thread with Cron (https://vborg.vbsupport.ru/showthread.php?t=205691)

bananalive 02-17-2009 04:09 PM

Create New Thread with Cron
 
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.

bananalive 02-18-2009 08:03 AM

I tried using datamanager to no avail :(

PHP Code:

<?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($vbulletinERRTYPE_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(''$nextitem1);

?>


ragtek 02-18-2009 08:20 AM

what error are you getting?

i think
PHP Code:

$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

Quote:

Originally Posted by ragtek (Post 1747670)
i think
PHP Code:

$userinfo fetch_userinfo(1); 

isn't possible, try this:
$postuser = 1;
$userinfo = fetch_userinfo($postuser);
also with fetch_foruminfo

Cheers that worked :D


All times are GMT. The time now is 10:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01471 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete