vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Code to Post automatically (https://vborg.vbsupport.ru/showthread.php?t=82969)

VBCoder 06-12-2005 05:51 PM

Code to Post automatically
 
I wrote some code to use DM to post:
PHP Code:

$newpost =& datamanager_init('Thread_FirstPost'$vbulletinERRTYPE_ARRAYthreadpost);
$newpost->set('forumid'2);
$newpost->set('title'"Test " rand());
$newpost->set('userid'"1");
$newpost->set('pagetext'"Testing Testing Testing Testing " rand() . " " rand());
$newpost->set('allowsmilie'0);

if (
$newpost->errors)
{
    print (
"Errors: ");
    
print_r ($newpost->errors);
} else {
    print (
$newpost->save());


After running it, the new posts do appear in the thread and post table, but, they don't show on the forum pages! (I wrote similar code to reply to threads, and got the same results).

I'm not sure what the problem is... it seems like the forum pages are denormalized and need to be rebuilt explicilty... I took a look at the build_new_post() and they used set_info() instead of plain set() - not sure what that is or if it's relevant.

Any ideas?

Zachery 06-12-2005 06:04 PM

Quote:

Originally Posted by VBCoder
I wrote some code to use DM to post:
PHP Code:

$newpost =& datamanager_init('Thread_FirstPost'$vbulletinERRTYPE_ARRAYthreadpost);
$newpost->set('forumid'2);
$newpost->set('title'"Test " rand());
$newpost->set('userid'"1");
$newpost->set('pagetext'"Testing Testing Testing Testing " rand() . " " rand());
$newpost->set('allowsmilie'0);

if (
$newpost->errors)
{
    print (
"Errors: ");
    
print_r ($newpost->errors);
} else {
    print (
$newpost->save());


After running it, the new posts do appear in the thread and post table, but, they don't show on the forum pages! (I wrote similar code to reply to threads, and got the same results).

I'm not sure what the problem is... it seems like the forum pages are denormalized and need to be rebuilt explicilty... I took a look at the build_new_post() and they used set_info() instead of plain set() - not sure what that is or if it's relevant.

Any ideas?

Did you update the forum cache as well?

VBCoder 06-12-2005 06:13 PM

Quote:

Did you update the forum cache as well?
No, I did not. I'm not familiar with this. How do I do this?

Zachery 06-12-2005 06:18 PM

There should be a function to update the datastore so the forums get recached.

VBCoder 06-12-2005 06:22 PM

I don't see it being called from build_new_post(). Zachary, are you sure? If so, could you show me this function?

On old versions, I've been able to do the whole thing simply using build_new_post, so this would be a big change


All times are GMT. The time now is 11:24 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.01008 seconds
  • Memory Usage 1,732KB
  • 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
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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