[nodebb-plugin-ns-custom-fields] NS Custom Fields
-
@nicolas is this fully compatible with node bb 1.9.2 persona theme?
i dont see this plugin in my ACP find plugins but i see this instead https://github.com/thadeuszlay/nodebb-plugin-thad-persona-custom-fields
dont know which 1 works fine?
-
Version 6.0.0
The new version is available. Summary: no new features.
- Changed compatibility with NodeBB v1.11.x
-
@Nicolas said in [nodebb-plugin-ns-custom-fields] NS Custom Fields:
Version 6.0.0
The new version is available. Summary: no new features.
- Changed compatibility with NodeBB v1.11.x
Does this plugin work with write api? if so what would be the data to post to modify? Because; _uid=2&steamid=test or _uid=2&customFields[0].steamid=test"
The key doesnt seem to work.
So I was looking into it, basically need to add routes etc, your code base is deeply confusing to me. So I'll just request and hopefully in the future youll add it
@Nicolas Can you please add custom fields routes to allow access via nodebb write api pretty please
-
@Nicolas @Joykiller Ah yeah, write API listens for some hooks if you want to add your own routes to the Write API
Seems a little redundant because you could just attach the route to
app
yourself in your init handler, but... well, there it is. -
@julian said in [nodebb-plugin-ns-custom-fields] NS Custom Fields:
@Nicolas @Joykiller Ah yeah, write API listens for some hooks if you want to add your own routes to the Write API
Seems a little redundant because you could just attach the route to
app
yourself in your init handler, but... well, there it is.Yeah decided to just write directly to mongo for what i need.
-
Hello! I have installed a plugin few days ago. Didn't seem to find anything related to it in my dashboard after I enabled it. Today I found this message in a log file
2019-05-22T17:12:02.076Z [4567/10922] - [31merror[39m: Error: Cannot find module './src/emitter' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Module.require.main.require (/home/nodebb/nodebb/require-main.js:8:10) at /home/nodebb/nodebb/node_modules/nodebb-plugin-ns-custom-fields/plugin/nodebb.js:9:31 at Object.<anonymous> (/home/nodebb/nodebb/node_modules/nodebb-plugin-ns-custom-fields/plugin/nodebb.js:47:3) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32)
Does somebody faced the same issue? I am using v1.12.1
-
@KuznyaOrg Yea getting same or similar reported error with ns-embed, discussed over here https://community.nodebb.org/topic/7135/nodebb-plugin-ns-embed-ns-embed/48
-
@Nicolas said in [nodebb-plugin-ns-custom-fields] NS Custom Fields:
Provides full set of instruments to create custom fields in user's profiles: admin control panel (manage available fields), user account (edit and view fields);
Install
npm install nodebb-plugin-ns-custom-fields
ACP
Preview of Admin Control Panel for Custom Fields Plugin,
ver. 1.0
Theme Status
Currently zero themes support this plugin. With template engine of NodeBB, some changes should be made manually to the theme, if you want to see custom fields in the user's profile.
It will look like:
Why I can't see the the custom field page after install the plugin via the admin install plugin. I tried rebuild and restart the server. Where does it located?
-
I update the version from 5.x.x to 6.0.0 which 5.x.x installed via admin plugin portal. I can see the custom field plugin under the "Plugin" of admin portal.
A new issue, I added some custom fields, but it does not show in user edit profile page /user/xxxxx/edit. Any one can help?
NodeBB version: v1.12.2
-
@Fei-Wong said in [nodebb-plugin-ns-custom-fields] NS Custom Fields:
page /user/xxxxx/edit
There should be one more button under the avatar.
-
Hello,
This plugin seem to be working good on v1.13.4-5. I can add fields, change them throgh the user profile... and I can see fields are exposed to the api/user/$username so it is easy to add to that specific template... /user/$username
I am new to plugin and theme development for NodeBB... I am having a hard time to make like the custom fields be available on other pages template such as topi.tpl for example.
On the Topic API you have information about the user like as follows.. my goal is to expose some or all custom fields there so I can add them to topic.tpl. Any idea how or where I can make that happen? ANY help is appreciated. Thanks!!
"user": {
"uid": 1,
"username": "admin",
"userslug": "admin",
"reputation": 4,
"postcount": 51,
"topiccount": 51,
"picture": null,
"signature": "",
"banned": 0,
"banned:expire": 0,
"status": "online",
"lastonline": 1602618059671,
"groupTitle": "["administrators"]",
"groupTitleArray": [
"administrators"
],
"icon:text": "A",
"icon:bgColor": "#673ab7",
"lastonlineISO": "2020-10-13T19:40:59.671Z",
"banned_until": 0,
"banned_until_readable": "Not Banned",
"selectedGroups": [],
"custom_profile_info": []
}, -
@andre-mosin said in [nodebb-plugin-ns-custom-fields] NS Custom Fields:
groupTitle
I think I am getting close:
https://github.com/NodeBB/NodeBB/blob/master/src/posts/user.js#L90-L103
Don't know really how to like add the field there... other then edit this file and add my custom field... but that's like a hack and I would need like create a fork of NodeBB... I might do it but I would rather fix or fork the plugin. Thanks!
-
@andre-mosin In the code you link there is a hook you can use to add you custom fields.
const result = await plugins.fireHook('filter:posts.addUserFields', { fields: fields, uid: uid, uids: uids, });
Write a plugin and use this hook to add the custom fields into the
fields
array. Also see this post. -
@baris Thank you so much! That worked! Getting closer.. Now I am able to add the field But with no value... it is not loading the value properly from /api/user, the "customFields" value is always "null".
I tried other fields that are native to NodeBB like "joindate" for example and it works fine.
here is a topic:
here is the user admin:
that array is not empty... Any idea how to fix this? Thanks again!
-
so I just made it to work by adding the value of that field using another hook filter:topics.addPostData... it seems redundant code though... will have to loop through all posts and add customField for each user of each post in the topic.
Hopefully there is a better way of doing that...
-
Are you storing that field on the user object in the database? You have to if you're using the hook as baris said.
-
@pitaj said in [nodebb-plugin-ns-custom-fields] NS Custom Fields:
that field on the user object
Sorry I am not sure if I understood your question. Using that hook mentioned by Baris I am able to add fields to User object inside of Topic posts, however the values of the fields coming from this ns-custom-fields plugin that are inserted into api/user/$username are not getting loaded. In order to load that I have to basically add an extra hook filter:topics.addPostData and load it from database again.... from what I am understanding that's how it works because the data from the ns-custom-fields plugin is not persistent on the user's object.
I am getting to understand the hook system and the plugins now and probably what I did has to be done unless there is a better way. I will share my code once I am done. Thanks!
-
@andre-mosin sorry I made a couple big typos there. I meant to ask if you are storing the user data on the user object in the database.
-
@pitaj I was trying to figure that out and I think it is like a sub key in the user object like:
{
"_key": "user:1:ns:custom_fields",
"myField": "test value"
}it doesn't look like a regular field in the user object which is like this:
{
"_key": "user:1",
....
"joindate": 1602212738594,
"lastonline": 1602703044144,
"status": "online",
"uid": "1",
"username": "admin",
"userslug": "admin",
...
"reputation": 4
}