Using DataWriter to Add to Database

James

Well-known member
When doing:
PHP:
$dw->set('newField', $newValue);
It gives me an error "the field newField was not recognised".

I'm guessing this error is because my new field isn't present in the _getFields() function in XenForo_DataWriter_User.

Assuming the above is correct: How would I go about adding my new field to the _getFields() function? Would I just extend it, call parent::_getFields() and then array_merge my new field to it? Or is there a more "proper" method?

Assuming the above is wrong: Correct me :D

Note: All I want to do is modify a new field in the xf_user table.

UPDATE: Managed it by appending to the xf_user array.
 
Top Bottom