Related issue: https://github.com/NodeBB/NodeBB/issues/1978
This is another breaking change. It effects anyone using the hook filter:user.custom_fields and filter:register.build to add custom data to users on registration.
If you were using filter:user.custom_fields to add new entries into the user object you can just switch the hook you are using to filter:user.create. No need to change anything else.
If you are using filter:register.build to add new entries into the registration form and want these entries to get added into the user object you need to use the hook filter:user.custom_fields. In your plugin that adds new entries into the registration form just add a listener for filter:user.custom_fields and add the fields that you added to the form into the array passed in, here is a sample.
// plugin.json
{
...
"hooks": [
{ "hook": "filter:user.custom_fields", "method": "addCustomFields"}
],
...
}
//plugin code
function addCustomFields(fields, callback) {
fields.push('newCustomField1'); // must match the input name you added to regForm
fields.push('otherCustomField1');
callback(null, fields);
}
After this when a new user registers they will have newCustomField1 and otherCustomField1 entries in their user object.
@bentael nothing needs to be done for spam-be-gone since we don't want the captcha form entries in the database anyways.
Before this change it was possible to add any field into the registration form client side and it was inserted into the database. Now only the fields that core and plugins specify are inserted.