SpecialK
Well-known member
I am trying to extend the forum datawriter, but I'm not doing something right. My datawriter is definitely getting initiated (IE all listeners are correct) but when I try to save a forum from the backend, I am given the error of: The field 'my_custom_field' was not recognised.
Here is my datawriter:
The new column exists in xf_forum and my forum edit screen in the admincp is showing the correct database value. The only thing holding me up is that I can't save it for some reason and I'm having a hard time finding an existing addon that extends a core datawriter.
Here is my datawriter:
PHP:
<?php
class TFP_Addon_Extend_DataWriter_Forum extends XFCP_TFP_Addon_Extend_DataWriter_Forum
{
protected function _getFields()
{
return parent::_getFields() + array('xf_forum' => array(
'my_custom_field' => array('type' => self::TYPE_UINT, 'default' => 0)));
}
protected function _preSave()
{
if (XenForo_Application::isRegistered('my_custom_field'))
{
$this->set('my_custom_field', $this->get('my_custom_field'));
} else {
$this->set('my_custom_field', 0);
}
return parent::_preSave();
}
}
The new column exists in xf_forum and my forum edit screen in the admincp is showing the correct database value. The only thing holding me up is that I can't save it for some reason and I'm having a hard time finding an existing addon that extends a core datawriter.