vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Update Post/Thread Count with DataManager (https://vborg.vbsupport.ru/showthread.php?t=120781)

maximux1 07-11-2006 02:19 AM

That didn't seem to do the trick, JumpD.

Here is my current script. Applying the change as I think it should be applied does not produce any errors, however at also does not create the thread/post.
PHP Code:

$threaddm =& datamanager_init('Thread_FirstPost'$vbulletinERRTYPE_ARRAY'threadpost');  
// $threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);  replaced with the above line.
$foruminfo['forumid'] = '2';
$forumid $foruminfo['forumid'];
$postuserid $userid;
$userid $userid;
$pagetext $article;
$allowsmilie '1';
$visible '1';

$threaddm->do_set('forumid'$forumid);
$threaddm->do_set('postuserid'$postuserid);
$threaddm->do_set('userid'$userid);
$threaddm->do_set('username'$username);
$threaddm->do_set('pagetext'$pagetext);
$threaddm->do_set('title'$title);
$threaddm->do_set('allowsmilie'$allowsmilie);
$threaddm->do_set('visible'$visible);
$done $threaddm->save();

build_forum_counters($foruminfo['forumid']); 
build_user_statistics(); 

Any suggestions? Thanks a lot, I really appreciate your continued assistance.

:EDIT:
Im looking at your suggestions now, I will post an update in a few minutes.

Thank you!

Im definately going to have to play with this for a bit.

You've been a big help - I'll post if I get closer.

Code Monkey 07-11-2006 02:51 AM

This is how you should do it and what works for me every time.
PHP Code:

$threaddm =& datamanager_init('Thread_FirstPost'$vbulletinERRTYPE_ARRAY'threadpost');
$foruminfo['forumid'] = '2';

$foruminfo fetch_foruminfo($foruminfo['forumid']);
$threadinfo = array();

$forumid $foruminfo['forumid'];
$postuserid $userid;
$userid $userid;
$pagetext $article;
$allowsmilie '1';
$visible '1';

$threaddm->set_info('forum'$foruminfo);
$threaddm->set_info('thread'$threadinfo);
$threaddm->setr('forumid'$forumid);
$threaddm->setr('userid'$userid);
$threaddm->setr('pagetext'$pagetext);
$threaddm->setr('title'$title);
$threaddm->set('allowsmilie'$allowsmilie);
$threaddm->set('visible'$visible);

$threaddm->pre_save();
if(
count($threaddm->errors) < 1)
{
    
$threadid $threaddm->save();
    unset(
$threaddm);
    
build_thread_counters($threaddm);
}

build_forum_counters($foruminfo['forumid']); 

EDIT: Removed the postuserid bit you had. That's not needed for a thread.

EDIT2: I also just relized you are using do_set(). You are not supposed to call that directly.

maximux1 07-11-2006 07:29 PM

That did the trick perfectly, my friend.

I've learned a lot from you guys and I thank you for you taking the time to assist me in understanding how to use the vB construct.

Thanks again!


All times are GMT. The time now is 09:46 AM.

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.02604 seconds
  • Memory Usage 1,740KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete