2011-01-15, 02:38 PM
2011-01-15, 03:20 PM
require_once MYBB_ROOT."inc/datahandlers/post.php";
$user = get_user(1);
$new_thread = array(
"fid" => "1", // the forum id in which you would like to post the thread
"prefix" => 0, // the prefix id
"subject" => "My Subject", // subject
"icon" => 0, // icon id
"uid" => $user['uid'], // the user id of the poster
"username" => $user['username'], // the username of the poster
"message" => "This is my message :)", // message
"ipaddress" => get_ip(), // ipaddress
"posthash" => md5($user['uid'].random_str()), // posthash
);
$posthandler = new PostDataHandler("insert");
$posthandler->action = "thread";
$posthandler->set_data($new_thread);
if($posthandler->validate_thread())
{
$thread_info = $posthandler->insert_thread();
}
else
{
// trow error or something
}
2011-02-01, 09:28 AM
(2011-01-15, 03:20 PM)Aries-Belgium Wrote: [ -> ]require_once MYBB_ROOT."inc/datahandlers/post.php"; $user = get_user(1); $new_thread = array( "fid" => "1", // the forum id in which you would like to post the thread "prefix" => 0, // the prefix id "subject" => "My Subject", // subject "icon" => 0, // icon id "uid" => $user['uid'], // the user id of the poster "username" => $user['username'], // the username of the poster "message" => "This is my message :)", // message "ipaddress" => get_ip(), // ipaddress "posthash" => md5($user['uid'].random_str()), // posthash ); $posthandler = new PostDataHandler("insert"); $posthandler->action = "thread"; $posthandler->set_data($new_thread); if($posthandler->validate_thread()) { $thread_info = $posthandler->insert_thread(); } else { // trow error or something }
it's great code, but how to use this code bro???can you help me, i need this to show create thread link,,,thanks before,