R
ragtek
Guest
I'm using this code to create a thread:
It's working nice, but it doesn't update the Forum Statistics.
What's missing here?
PHP:
$writer = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
$writer->set('user_id', $visitor['user_id']);
$writer->set('username', $visitor['username']);
$writer->set('title', $input['subject']);
$postWriter = $writer->getFirstMessageDw();
$postWriter->set('message', $input['message']);
$writer->set('node_id', $forumId);
$writer->preSave();
$writer->save();
$thread = $writer->getMergedData();
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
$this->getDynamicRedirect(),
new XenForo_Phrase('your_message_has_been_sent')
);
What's missing here?