PDA

View Full Version : Forums won't show up as read, script-created Threads


Raphaelx
05-13-2011, 06:14 AM
Hey guys,

I create threads on worpdress publish, which works quite well..
but forums containing script-created threads won't show up as read if someone opened it...
mark as read works on every other user-generated threads.

fact sheet:

vBulletin setting for marking read threads is set to "database".
mark all forums as read does not work
the thread itself is marked as read while the forum is marked as containing new thread
deleting non existing threads/posts does not work.
the mysql-database records for user- & script-generated threads look similar.
when I delete the script-generated thread everything is normal again...



I use the following script to create the thread:
function createWPThread( $forumid, $title, $pagetext, $tags, $dateline ){
global $vbulletin, $db, $wp_vb_usermatch;

$open = '1';
$allow_smilie = '1';
$visible = '1';

$foruminfo = fetch_foruminfo($forumid);

$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$threaddm->set_info('forum', $foruminfo);
$threaddm->set('forumid', $forumid);

$threaddm->set('userid', 4); // = bot

if( strlen($title) < 3) { $title = 'Kein Titel vergeben.'; }
$threaddm->set('title', $title);
$threaddm->set('pagetext', $pagetext);

$threaddm->set('open', $open);
$threaddm->set('visible', $visible);
$threaddm->set('allowsmilie', $allow_smilie);
$threaddm->set('dateline', $dateline);

$threaddm->set('taglist', $tags);
$threaddm->set('views', 1);

// error checks
$threaddm->pre_save();
if (!empty($threaddm->errors)){ echo ($threaddm->errors); }

// save
$threadid = $threaddm->save();
unset($threaddm);

// rebuild caches
build_thread_counters($threadid);
build_forum_counters($forumid);

return $threadid;
}


--------------- Added 1305277209 at 1305277209 ---------------

threads are posted with future time due to gmt wez and est time-zone differences.... >.<