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 ?


  • 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);
  • 2 Votes
    12 Posts
    663 Views

    It’s worth adding @qwinter that 2.x is now completely stable.

  • 0 Votes
    2 Posts
    290 Views

    @pwsincd I think you can use userData.isAdmin = isAdmin; if I’m not mistaken - see
    https://community.nodebb.org/topic/15128/how-to-hide-whitelist-user-field-only-to-owner-or-admin?_=1648802303112 for an example

  • 4 Votes
    8 Posts
    2k Views

    @DownPW done

  • 3 Votes
    12 Posts
    980 Views

    @cagatay you’ll need to define this in the body tag (or another element if you want greater or more granular targets) - for example

    body { font-family: "Poppins"; font-size: 16px; }

    Essentially, you use the font-size CSS directive.

  • [NODEBB] Welcome Message

    Solved Customisation
    18
    13 Votes
    18 Posts
    2k Views

    For anyone reviewing this post, there’s an updated version here that also includes an sunrise / sun / moon icon depending on the time of day

    https://sudonix.com/topic/233/nodebb-welcome-message-with-logo-footer-change/3?_=1645445273209

  • 24 Votes
    112 Posts
    13k Views

    @DownPW as discussed in PM

    Seems to have been solved with the new JS code that you added allowing the version CSS file change!!

    Cache problem therefore with the JS of the Switcher theme

    Based on this, I will close this thread and reference
    https://sudonix.com/topic/207/nodebb-help-for-my-custom-css/27

  • NodeBB customisation

    Locked Customisation
    332
    27 Votes
    332 Posts
    71k Views

    @jac Given your departure away from your previous project, I’m going to close this thread… 🙂