Xenforo - create new thread with external data

blowzy

Member
Hello, is there something like Vbulletin Datamanager to simple create new threads / posts in my php code? Something like this:

PHP:
// [some connections from my code to xenforo] / how?
   $threaddm->set('forumid', $forumid);
   $threaddm->set('userid', $userid);
   $threaddm->set('pagetext', $pagetext);
   $threaddm->set('title', $title);
// "create/process" calback and $newthreadid returned.
    echo "new thread created with threadid $newthreadid";

Please, suggest something how to realise this. Maybe one way is only to create addon? Any commens are welcome. thanks
 
nice I found php code for xenforo datawriter, but what I need to include to my external script to use it???

PHP:
//post new thread on forum      
            $writer = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
            $writer->set('user_id', $userid);
            $writer->set('username', $username);
            $writer->set('title', $threadtitle);
            $postWriter = $writer->getFirstMessageDw();
            $postWriter->set('message', $intromsg);
  
            $writer->set('node_id', $nodeid);
                    $writer->preSave();
                    $writer->save();
                    $thread = $writer->getMergedData();
 
Back
Top Bottom