View Full Version : using dm to create thread reply and can't figure out how to get forumdisplay updated.
This is the code I'm using to create a thread reply, but how do I get the forumdisplay updated?
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');
$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
$bythreadid = '4375';
//$byparentid = '4375'; //not sure what this is for
$byusername = 'testing';
$byuserid = '0';
//$bytitle = 'testing'; //dont want a post title
$bypagetext = 'This is a test';
$byallowsmilie = '1';
$byshowsignature = '1';
$byvisible = '1';
$postdm->do_set('threadid', $bythreadid);
$postdm->do_set('username', $byusername);
$postdm->do_set('userid', $byuserid);
$postdm->do_set('title', $bytitle);
$postdm->do_set('pagetext', $bypagetext);
$postdm->do_set('allowsmilie', $byallowsmilie);
$postdm->do_set('showsignature', $byshowsignature);
$postdm->do_set('visible', $byvisible);
$postdm->save();
unset($postdm);
Andreas
10-28-2005, 02:49 PM
Hmm, it should do that automatically.
Are you sure it doesn't?
Is the forum moderated?
Hmm, it should do that automatically.
Are you sure it doesn't?
Is the forum moderated?
Nope, it doesn't. And nope, it isn't moderated. The post is there, but the thread doesn't even get bumped.
(The DM to create threads was the same way. It required calling build_forum_counters($forumid) after creating the thread to update everything)
Andreas
10-28-2005, 03:05 PM
Try
$threadinfo = fetch_threadinfo($bythreadid);
$foruminfo = fetch_foruminfo($thread['forumid');
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
Before setting anything to the DM.
Try
$threadinfo = fetch_threadinfo($bythreadid);
$foruminfo = fetch_foruminfo($thread['forumid');
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
Before setting anything to the DM.
Same result.
edit: Fixed it by adding
require_once('./includes/functions_databuild.php');
build_thread_counters($bythreadid);
imho, it should do all that automatically tho...
Andreas
10-28-2005, 03:33 PM
<?php
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');
$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
$bythreadid = '4375';
$threadinfo = fetch_threadinfo($bythreadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set('threadid', $bythreadid);
$postdm->set('username', 'testing');
$postdm->set('pagetext', 'This is a test');
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', TIMENOW);
$postdm->save();
unset($postdm);
?>
You should never call do_set() directly, also if you are making a post for a guest don't set the userid.
<?php
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');
$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
$bythreadid = '4375';
$threadinfo = fetch_threadinfo($bythreadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set('threadid', $bythreadid);
$postdm->set('username', 'testing');
$postdm->set('pagetext', 'This is a test');
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', TIMENOW);
$postdm->save();
unset($postdm);
?>
You should never call do_set() directly, also if you are making a post for a guest don't set the userid.
Neat! As usual, thanks for the help! <3
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.