XF 2.2 Updating a new user entity field via REST API

giperfast

Member
I extended the "XF\Entity\User" class to add a new field to get it when authorizing with ('api/auth/from-session').
The code looks like this:
PHP:
class User extends XFCP_User
{
    protected function setupApiResultData(\XF\Api\Result\EntityResult $result, $verbosity = self::VERBOSITY_NORMAL, array $options = [])
    {
        parent::setupApiResultData($result, $verbosity, $options);

        $result->includeColumn(['system_information']);
    }

    public static function getStructure(Structure $structure)
    {
        $structure = parent::getStructure($structure);

        $structure->columns['system_information'] = ['type' => self::STR, 'default' => '', 'maxLength' => 1024, 'changeLog' => true, 'api' => true];
      
        return $structure;   
    }
}

After that I try to update this field with ('api/users/$user_id'), but the field is not updated.
The request looks like this:
unknown.png

And the result is this:
unknown.png
 
Just extend this class via Class extensions subsystem?
I tried, but it didn't work.


PHP:
class User extends XFCP_User
{
    public function getAccountEditInput()
    {
        $tableInput = parent::getAccountEditInput();

        $tableInput['user'] = $this->filter([
            'system_information' => '?str',
        ]);

        return $tableInput;
    }
}
 
Back
Top Bottom