I have a php script that's being using the Xenforo_Datawriter in XF 1.5.6 to auto create posts.
After updating to Xenforo 2, the script no longer works but not sure why. Here's what the script currently uses.
It's not generating any errors that I can find, it just doesn't create the post. So not sure what's changed between versions.
After updating to Xenforo 2, the script no longer works but not sure why. Here's what the script currently uses.
Code:
$fileDir = "/home/nolatron/public_html/xxxxxxxxxxx/forums";
require($fileDir.'/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
$startTime = microtime(true);
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Application::disablePhpErrorHandler();
$writer = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
$writer->set('user_id', '2');
$writer->set('username', 'XXXXXXXXX');
$writer->set('node_id', '20');
$writer->set('titlexeno', ''.$fname.' '.$lname.'');
$writer->set('prefix_id', '1');
$postWriter = $writer->getFirstMessageDw();
$postWriter->set('message', 'POST CONTENT GOES HERE');
$writer->save();
It's not generating any errors that I can find, it just doesn't create the post. So not sure what's changed between versions.