PDA

View Full Version : Get thread id after creating the thread


caciocode
07-08-2013, 11:00 AM
Hi all,

I have looked for a solution for this but could not find it anywhere on the Internet. I am using the following script to create a thread externally. I would like to get the thread id of the thread that has just been created.


<?php

$forumid = 2;
// The user id of the person posting
$user = htmlspecialchars_uni( fetch_userinfo($userid) );
$title = $post_array->post_title;
$pagetext = addslashes($post_array->post_content);
$allowsmilie = '1';
$visible = '1';

$foruminfo = fetch_foruminfo($forumid);
$threadinfo = array();


$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();
echo '<pre>';
//print_r ($threaddm);
echo '</pre>';

print_r ($newpost);
print_r ($threadinfo);
echo fetch_threadinfo($newpost);
echo '<br />The new thread id is: '.$newpost['threadid'];

?>


Please help. Thank you.

--------------- Added 1373285840 at 1373285840 ---------------

Ooops.

Please transfer this thread to the programming forum. I made a mistake posting it here.

caciocode
07-09-2013, 07:07 PM
Here is the solution that I have used just in case someone comes across this thread.

$thread_id = $threaddm->pre_save()