@Nicolas looks good! Last but not least, please use translation keys:
This is not good for international boards:
file: fields-edit.js
line 34: .text('Save Fields')
....
line 96: app.alertSuccess('Custom Fields are saved');
@Nicolas looks good! Last but not least, please use translation keys:
This is not good for international boards:
file: fields-edit.js
line 34: .text('Save Fields')
....
line 96: app.alertSuccess('Custom Fields are saved');
Warning in console:
25/4 11:57 [28225] - warn: [plugins] Callback timed out, hook 'static:app.load' in plugin 'nodebb-plugin-ns-custom-fields'
I found another problem: Try to edit any user's profile as admin and you will see custom fields populated with admin's data.
NodeBB 0.7, new version error on startup:
25/4 07:34 [27825] - error: Error: Cannot find module 'object-assign'
Sorry, npm install
should fix that problem.
Can you also add those custom fields in post data, so we can display them somewhere under user's avatar or something like that.
Small suggestion, check if Custom Field value is url and replace it with link.
filters.js
:
4: var urlRegex = /(((https?:\/\/)|(www\.))[^\s]+)/i;
..
..
26: if (result.data) {
var i = 0, len = result.fields.length, fieldMeta, customFields = params.userData.customFields || [];
for (i; i < len; ++i) {
fieldMeta = result.fields[i];
var value = result.data[fieldMeta.key];
if (value) {
customFields.push({
name : fieldMeta.name,
value: value.match(urlRegex)? urlify(value) : value
});
}
}
params.userData.customFields = customFields;
39: }
..
..
53: function urlify(text) {
return text.replace(urlRegex, function(url,b,c) {
var url2 = (c == 'www.') ? 'http://' +url : url;
return '<a href="' +url2+ '" target="_blank">' + url + '</a>';
})
58: }
Last error I found in : nodebb-plugin-ns-custom-fields/public/js/fields-edit.js
line 61:
- .val(content[fieldEntity.key]);
+ .val(content && content[fieldEntity.key]);
Now it works as expected. Thanks @Nicolas !
result.data
is empty, thats why it has error, to fix this you have to add check in:
/nodebb-plugin-ns-custom-fields/app/filters.js
from line 24:
if (result.data) {
var i = 0, len = result.fields.length, fieldMeta, customFields = [];
for (i; i < len; ++i) {
fieldMeta = result.fields[i];
var value = result.data[fieldMeta.key];
if (value) {
customFields.push({
name : fieldMeta.name,
value: value
});
}
}
params.userData.customFields = customFields;
}
callback(null, params);
@Nicolas can you show template changes for I found it in account/edit.tpl
file.nodebb-plugin-ns-custom-fields/templates/account/edit.tpl
When I try to access user profile page I got error:
24/4 08:46 [27022] - error: TypeError: Cannot read property 'proglangs' of null at /home/apps/nodebb/node_modules/nodebb-plugin-ns-custom-fields/app/filters.js:28:40
proglangs
is the first key in custom fields. I use NodeBB 0.7