I need to call XenForo_Model_InlineMod_Thread::applyThreadPrefix so that I can change the prefix of one or more threads.
Yes, the user is authorized, and so is the forum for that particular prefix.
I am calling the function from an extention of XenForo_ControllerPublic_InlineMod_Thread, so I am creating that class:
$threadInlineModel = XenForo_Model::create('DaVinciDigital_GuildManager_Extend_Model_InlineMod_Thread');
$unchangedThreadsIds = array(); $errorKey = ''; $options = array (); $prefixId = (string)$guilds[$thread['node_id']]['deguilded_prefix_id']; $threadInlineModel->applyThreadPrefix($threadDeguilded, $prefixId, $unchangedThreadIds, $options, $errorKey);
I tried to mimic the function by creating a new datawriter, and that doesn't work either: it simply does not write to DB. The only solution I found was to raw write to the DB with this:
$db = XenForo_Application::get('db'); $db->query(" UPDATE xf_thread SET prefix_id = ".$guilds[$thread['node_id']]['deguilded_prefix_id'] . " WHERE thread_id = ".$thread['thread_id']); XenForo_Db::commit();
Any idea on what I may be missing?