Overriding an option?

Renari

Member
I've been trying to override the boardIndex option and the only way I can see to do it is to make a class that extends the autoloader class and have it override the value and use XenForo_Autoloader::setInstance() to force the modified version.

I haven't tested the above but does anyone know of an easier way to go about doing this?
 
Thanks Chris,
PHP:
    public static function indexRouteOverride(XenForo_Dependencies_Abstract $dependencies, array $data)
    {
        $dw = XenForo_DataWriter::create('XenForo_DataWriter_Option');
        $dw->setExistingData('indexRoute');
        $dw->setOption('indexRoute', 'home');
        $dw->save();
    }

I was calling this at the init_dependancies hook and it says that indexRoute is an unknown option. I believe this is because at that time the board hasn't loaded any of it's options. But I can't seem to find a better place to put this, assuming I'm even using the datawriter class correctly which it's entirely possible I'm not.
 
Last edited:
This is what you need to do:

PHP:
    public static function indexRouteOverride(XenForo_Dependencies_Abstract $dependencies, array $data)
    {
        $dw = XenForo_DataWriter::create('XenForo_DataWriter_Option');
        $dw->setExistingData('indexRoute', true);
        $dw->set('option_value', 'home');
        $dw->save();
    }
 
Top Bottom