1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

The field 'silverpopintegration_subscription' was not recognised.

Discussion in 'XenForo Development Discussions' started by Radi, Aug 5, 2015.

  1. Radi

    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:
    class SilverpopIntegration_XenForo_ControllerPublic_Account extends XFCP_SilverpopIntegration_XenForo_ControllerPublic_Account {
        public function 
    actionEmailPreferencesSave() {

    $visitor XenForo_Visitor::getInstance();

            if (!
    $visitor->canEditProfile()) {

    $settings $this->_input->filter(array(
    'silverpopintegration_subscription' => XenForo_Input::UINT,

    $writer XenForo_DataWriter::create('XenForo_DataWriter_User');
    //$writer->setCustomFields($customFields, $customFieldsShown);

            if (
    $dwErrors $writer->getErrors()) {



    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);



    class SilverpopIntegration_Listener {
        * @var XenForo_ControllerRegister_Register::actionRegister
    public static $register;

        public static function 
    loadControllers($class, array &$extend) {
    $controllers = array(



    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!
  2. Jake B.

    Jake B. Well-Known Member

    Are you sure SilverpopIntegration_XenForo_DataWriter_User is being loaded? Try throwing a die('test'); into the _getFields().

    I do see that your function is called loadControllers. Make sure you aren't using the load_class_controller code event for that.
  3. Radi

    Radi Member

    That was it.

    I added load_class_datawriter and used the same class::method and it worked! Thank you man!
  4. Radi

    Radi Member

    @Jake B. do you have any idea why

    $settings = $this->_input->filter(array('silverpopintegration_subscription' => XenForo_Input::UINT));

    is not getting populated from my form?
  5. Jake B.

    Jake B. Well-Known Member

    Do you have a form that has a field called silverpopintegration_subscription?
  6. Radi

    Radi Member

  7. Radi

    Radi Member

    I am testing now with $writer->set('silverpopintegration_subscription', $this->_input->filterSingle('silverpopintegration_subscription', XenForo_Input::BOOLEAN)); but still not good.

    here is my form:
    <xen:title>{xen:phrase silverpopintegration_email_preferences}</xen:title>
    <xen:require css="silverpopintegration_account_email_preferences.css" />
    <form method="post" class="xenForm formOverlay NoFixedOverlay AutoValidator"
        action="{xen:link 'account/email-preferences-save'}"
        data-fieldValidatorUrl="{xen:link 'account/validate-field.json'}"
        <h3 class="sectionHeader">{xen:phrase silverpopintegration_options}</h3>
        <xen:hook name="silverpopintegration_account_email_preferences_options">
        <dl class="ctrlUnit">
                        <label for="silverpopintegration_subscription"><input type="checkbox" name="visible" value="1" id="silverpopintegration_subscription" class="OptOut Disabler" {xen:checked "{$silverpopintegration_subscription}"} /> {xen:phrase silverpopintegration_subscription}</label>
                        <p class="hint">{xen:phrase silverpopintegration_subscription_hint}</p>
                        <!--<ul id="silverpopintegration_subscription_weekly">
                                <label><input type="checkbox" name="activity_visible" value="1" class="OptOut" {xen:checked $silverpopintegration_subscription} /> {xen:phrase show_your_current_activity}</label>
                                <p class="hint">{xen:phrase this_will_allow_other_people_to_see_what_page_you_currently_viewing}</p>
                <xen:if is="!{$xenOptions.swfUpload}">
                    <input type="hidden" name="enable_flash_uploader" value="{xen:if $visitor.enable_flash_uploader, 1, 0}" />
        <dl class="ctrlUnit submitUnit">
            <dd><input type="submit" name="save" value="{xen:phrase save_changes}" accesskey="s" class="button primary" /></dd>
        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
  8. Radi

    Radi Member

    I found my error. I copied the code and never updated the input name...

    I am able to update the DB, but now I am not able to retrieve the value from it.

    EDIT: I found a work around that by using $visitor['silverpopintegration_subscription'], but would like to know what I am doing wrong? Do I need to extend XenForo_Model_User and setup some methods in there?
    Last edited: Aug 6, 2015

Share This Page