Skip to content

[NodeBB] Custom fields plugin

Unsolved Customisation
  • Hi again , on our sire we require the use of custom user fields so we can refer to them with our own bespoke plugin we are going to develop , however this plugin https://github.com/NicolasSiver/nodebb-plugin-ns-custom-fields fails to function on recent builds of nodeBB i wonder if anyone here has had any success in getting custom fields to work ? some of the code in the default nodebb suggests it is already possible .

    Also this plugin would be more suitable as it suggests registration fields… but likewise it fails https://www.npmjs.com/package/nodebb-plugin-itu-custom-registration-fields

  • @pwsincd This is always a problem with Open Source development in the sense that packages are often suddenly abandoned and no response ever provided to any requests. Does this plugin make NodeBB crash, or does it actually install ?

    I think the only way forward here is to fork and update it for the latest version, which may take some time.

  • @phenomlab it appears to install but has nothing to work on … no admin edits visible etc…

  • @pwsincd On checking this plugin, the install appears to actually fail - see the below from the log

    022-04-01T10:43:11.554Z [4567/513037] - warn:    [plugins/nodebb-plugin-ns-custom-fields] The plugin.json field "library" is deprecated. Please use the package.json field "main" instead.
    2022-04-01T10:43:11.555Z [4567/513037] - warn: [plugins] Unable to load library for: nodebb-plugin-ns-custom-fields
    2022-04-01T10:43:11.555Z [4567/513037] - error: Error: Cannot find module './src/emitter'
    Require stack:
    - /home/sudonix/nodebb/require-main.js
    - /home/sudonix/nodebb/app.js
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
        at Function.Module._load (internal/modules/cjs/loader.js:746:27)
        at Module.require (internal/modules/cjs/loader.js:974:19)
        at require (internal/modules/cjs/helpers.js:101:18)
        at Module.require.main.require (/home/sudonix/nodebb/require-main.js:8:10)
        at /home/sudonix/nodebb/node_modules/nodebb-plugin-ns-custom-fields/plugin/nodebb.js:9:31
        at Object.<anonymous> (/home/sudonix/nodebb/node_modules/nodebb-plugin-ns-custom-fields/plugin/nodebb.js:47:3)
        at Module._compile (internal/modules/cjs/loader.js:1085:14)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
        at Module.load (internal/modules/cjs/loader.js:950:32)
    
  • @pwsincd hi. Just following up on this thread (I know it’s old) but was curious to understand if it’s still an issue or not ?


  • 5 Votes
    4 Posts
    480 Views

    @DownPW thanks. I forgot about that.

  • 13 Votes
    30 Posts
    1k Views

    Here’s a small modification to the chatBanner function that will place the message just above the composer/reply component meaning it is pinned at the bottom and always in view as a reminder. I’ve made this change to support the threadedChat I’m currently developing

    // Chat message banner function chatBanner() { var roomName = $("h5[component='chat/header/title']").text().trim(); var bannerContent; if (roomName === "Testing 3") { bannerContent = '<div id="chatbanner">This message will fire for chat rooms with the title of "Testing 3"</div>'; } else { bannerContent = '<div id="chatbanner">This session is for <strong>private discussion only</strong> between the chosen participants. Please do <strong>not</strong> place support requests here and create a <a href="#" onclick="app.newTopic();">new topic</a> instead.</div>'; } var chatMessagesContainer = $('[component="chat/system-message"]:last-of-type'); //var existingMessages = $('[component="chat/message"]'); var existingMessages = $('[component="chat/composer"]'); if (existingMessages.length === 0) { // If there are no messages, append the banner to the messages container chatMessagesContainer.first().after(bannerContent); } else { // If there are messages, add the banner after the last message // existingMessages.last().after(bannerContent); existingMessages.before(bannerContent); } }

    There are only two changes here:

    var existingMessages = $('[component="chat/message"]');

    becomes

    var existingMessages = $('[component="chat/composer"]');

    and

    existingMessages.last().after(bannerContent);

    becomes

    existingMessages.before(bannerContent);
  • 6 Votes
    15 Posts
    700 Views

    No no, I said that in the sense that he told me it was simple ^^
    I was able to see that this was not the case by targeting the elements he had advised me.

  • Custom badges

    Solved Customisation
    103
    49 Votes
    103 Posts
    9k Views

    Perfect 😉

  • 38 Votes
    193 Posts
    29k Views

    OMG make sense

    Thanks dude 🙂

  • 0 Votes
    7 Posts
    725 Views

    @downpw ooops. Forgot that. Thanks for adding.

  • [NODEBB] Stats

    Unsolved Customisation
    20
    2 Votes
    20 Posts
    1k Views

    @phenomlab said in [NODEBB] Stats:

    @jac or I land up fixing it 🙂

    I wouldn’t put it past you 😛

  • 4 Votes
    5 Posts
    641 Views

    @phenomlab thanks 🙏