Call function if Admin Option Changes?


Active member

I am working on an add-on and would like to clear out a cache directory if a setting changes.

I have seen that you can run a validation callback, is it possible to use this to determine if the value has changed?

i.e. I don't want to clear the cache directory everytime someone presses save in the ACP settings, only if this specific settings value has changed.

Chris D

XenForo developer
Staff member
You have access to the $dw object, see XenForo_Option_TemplateFiles for an example.

You can do: $dw->getExisting('option_value') and compare that to $option or simply, $dw->isChanged('option_value');
Last edited:


Active member
isChanged didn't seem to work, but getExisting did, so I have been able to create an if statement which does what I want.

Thanks for the help. :)