Changing Phrases

bottiger

Active member
I am using XenForo_Model_Phrase to change a phrase through code but it doesn't show up on the forum, but it shows up in the control panel.

If I edit the phrase through the admin panel it shows up on the forum.

Here is the code that I tried to emulate from XenForo_ControllerAdmin_Phrase::actionSave.

PHP:
$phraseModel = XenForo_Model::create('XenForo_Model_Phrase');
$phrase = $phraseModel->getPhraseInLanguageByTitle('field_35_choice_7', 1);

$dw = XenForo_DataWriter::create('XenForo_DataWriter_Phrase');
$dw->setExistingData($phrase['phrase_id']);
$dw->set('phrase_text', 'test4');
$changed = $dw->isChanged('phrase_text');
if($changed) {
  $dw->updateVersionId();
  echo 'changed';
}
$dw->save();

There appears to be some sort of caching done by new XenForo_Phrase but I am not sure how to clear it.
 
Last edited:
Back
Top Bottom