Fixed Deleting an option group leaves an orphaned phrase

Chris D

XenForo developer
Staff member
Steps to reproduce:
  • Create an add-on
  • Create an option group
    • This will create two phrases:
      • option_group_optionGroupId
      • option_group_optionGroupId_description
  • Create an option
    • This will create another two phrases:
      • option_optionId
      • option_optionId_explain
  • Delete the entire option group
  • Everything is deleted as it should be, except for one phrase:
    • option_optionId_explain

Cause:

In the Option Model, the "deleteOptionsInGroup" function which is invoked by the OptionGroup DataWriter "postSave" function only deletes the Title phrase:

PHP:
$phraseModel->deleteMasterPhrase($this->getOptionTitlePhraseName($optionId));

Fix:

Replace above line with:

PHP:
					$phraseModel->deleteMasterPhrases(array(
						$this->getOptionTitlePhraseName($optionId),
						$this->getOptionExplainPhraseName($optionId)
					));
 
Top Bottom