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

Error with DataWriter

#1
Hi !

I have an error with my DataWriter code :)
When I try to save a new custom text in a field of a table of my DB I have this error :

The requested user could not be found.
The field 'csrf_token' was not recognised.
PLease enter a valid password.
The field 'scheme_class' was not recognised.
The field 'data' was not recognised.
The field 'language_id' was not recognised.

Here is my datawriter code :
PHP:
<?php

class onglet_DataWriter_Onglet extends XenForo_DataWriter_User
{
    protected function _getFields()
    {
       return array(
           'xf_user_profile' => array(
               'titre_onglet' 
                   => array('type' => self::TYPE_STRING, 'maxLength' => 25)
           )
        );
    }
    protected function _getExistingData($data)
    {
        if (!$userId = $this->_getExistingPrimaryKey($data, 'user_id'))
        {
            return false;
        }

        if (!$user = $this->_getUserModel()->getFullUserById($userId))
        {
            return false;
        }

        $returnData = $this->getTablesDataFromArray($user);
        $returnData['xf_user_authenticate'] = $this->_getUserModel()->getUserAuthenticationRecordByUserId($userId);

        return $returnData;
    }

    /**
    * Gets SQL condition to update the existing record.
    *
    * @return string
    */
    protected function _getUpdateCondition($tableName)
    {
        return 'user_id = ' . $this->_db->quote($this->getExisting('user_id'));
    }
}
Thanks