Well, I have read some plugin code already, but I have yet to write my own one.
You mean like so?
In plugin.json
:
...
"hooks": [
{ "hook": "filter:user.create", "method": "createUser" },
{ "hook": "filter:user.whitelistFields", "method": "whitelistFields" }
]
...
In my plugin library.js
:
plugin.createUser = function(data, callback) {
data.user.customField = data.data.customField;
callback(null, data);
};
plugin.whitelistFields = function(data, callback) {
data.whitelist.push('customField');
callback(null, data);
};