Radi
Member
When I try to save to xf_user_option I get this: "The field 'silverpopintegration_subscription' was not recognised."
Here is my code:
My SilverpopIntegration_XenForo_ControllerPublic_Account works, so that should mean that my Controllers listener is working fine. SilverpopIntegration_XenForo_DataWriter_User does not seem to be loading at all.
What is going on?
Please help!
Here is my code:
PHP:
class SilverpopIntegration_XenForo_ControllerPublic_Account extends XFCP_SilverpopIntegration_XenForo_ControllerPublic_Account {
public function actionEmailPreferencesSave() {
$this->_assertPostOnly();
$visitor = XenForo_Visitor::getInstance();
if (!$visitor->canEditProfile()) {
return $this->responseNoPermission();
}
$settings = $this->_input->filter(array(
//user_option
'silverpopintegration_subscription' => XenForo_Input::UINT,
));
$writer = XenForo_DataWriter::create('XenForo_DataWriter_User');
$writer->setExistingData(XenForo_Visitor::getUserId());
$writer->bulkSet($settings);
//$writer->setCustomFields($customFields, $customFieldsShown);
$writer->preSave();
if ($dwErrors = $writer->getErrors()) {
return $this->responseError($dwErrors);
}
$writer->save();
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
$this->getDynamicRedirect(XenForo_Link::buildPublicLink('account/email-preferences'))
);
}
}
PHP:
class SilverpopIntegration_XenForo_DataWriter_User extends XFCP_SilverpopIntegration_XenForo_DataWriter_User {
/**
* Gets the fields that are defined for the table. See parent for explanation.
*
* @return array
*/
protected function _getFields() {
$fields = parent::_getFields();
$fields['xf_user_option']['silverpopintegration_subscription'] = array('type' => self::TYPE_BOOLEAN, 'default' => 1);
Zend_Debug::dump($fields);
return $fields;
}
}
PHP:
class SilverpopIntegration_Listener {
/**
*
* @var XenForo_ControllerRegister_Register::actionRegister
*/
public static $register;
public static function loadControllers($class, array &$extend) {
static $controllers = array(
'XenForo_ControllerPublic_Account',
//'XenForo_ControllerPublic_Register',
//'XenForo_ControllerAdmin_Tools',
//'XenForo_ControllerAdmin_Option',
'XenForo_DataWriter_User'
);
if(in_array($class, $controllers)) {
$extend[] = 'SilverpopIntegration_' . $class;
}
}
}
My SilverpopIntegration_XenForo_ControllerPublic_Account works, so that should mean that my Controllers listener is working fine. SilverpopIntegration_XenForo_DataWriter_User does not seem to be loading at all.
What is going on?
Please help!