Skip to content

Plugin Development

Have a question about building a plugin? Ask here
445 Topics 1.9k Posts
  • Is it possible to call an API from another server?

    Unsolved
    2
    0 Votes
    2 Posts
    57 Views
    julianJ
    @fahx00s if your other server is using oauth2, then use sso-oauth2-multiple plugin
  • Is it possible to override server side javascript from my plugin?

    4
    0 Votes
    4 Posts
    86 Views
    Sky FoxxS
    Perfect! Does the job super elegantly thank you
  • Is it possible to override client side javascript from my plugin?

    2
    0 Votes
    2 Posts
    88 Views
    barisB
    You should be able to overwrite a core module completely using your plugins modules section. For example to overwrite the navigator module with your own you can do. "modules": { "navigator": "public/navigator.js" }, Copy the navigator module from core and make your changes and it will replace the core module during build.
  • component="chat/nav-wrapper" not updated when new messages come in.

    2
    0 Votes
    2 Posts
    110 Views
    barisB
    This commit implements that, the teasers are updated in the event event:unread.updateChatCount because that is sent even if the user is not currently in that room. https://github.com/NodeBB/NodeBB/commit/ac644ac2866bfa48a939a94b6ec34ad9fd493f7d
  • New chat messages notifications in digest email.

    6
    0 Votes
    6 Posts
    236 Views
    barisB
    You can also use db.objects.updateMany
  • users chats page

    2
    0 Votes
    2 Posts
    144 Views
    barisB
    You could use the below custom javascript, it will open the last chat if there is no open chat. $(window).on('action:ajaxify.end', async () => { const { data } = ajaxify; if (data.template.chats && !data.template.roomId && data.rooms.length) { const Chats = await app.require('forum/chats'); Chats.switchChat(data.rooms[0].roomId); } });
  • Invalid plugin ID ?

    2
    +0
    0 Votes
    2 Posts
    167 Views
    barisB
    What is the name of the plugin? Does it start with nodebb-plugin-?
  • Propagating changes back to users

    7
    0 Votes
    7 Posts
    252 Views
    R
    I ended up adding a child span to hold the tooltip, and just removing the child altogether anytime the event fired. Inserting a new element and then setting the tooltip was the only way to get the tooltip updated correctly (for me). Thanks for the help!
  • Topic create and update via API and event sequencing

    2
    0 Votes
    2 Posts
    166 Views
    barisB
    A socket event is sent when a new topic or reply is made, they are called event:new_topic and event:new_post. We listen to that and update the ui when a new reply comes in.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    405 Views
  • Advanced Search Widget

    3
    0 Votes
    3 Posts
    583 Views
    L
    @יושב-אוהלים Hi, I would appreciate it if you could write how it can be done
  • Customization of Bootbox

    2
    0 Votes
    2 Posts
    184 Views
    barisB
    Depending on what you want to change, you can modify it via css or override the bootbox.dialog method like we do in core https://github.com/NodeBB/NodeBB/blob/master/public/vendor/bootbox/wrapper.js#L27-L45
  • Plugin created and activated. However, it doesn't show on admin panel.

    2
    0 Votes
    2 Posts
    142 Views
    barisB
    Try navigating to the route created by the plugin for the admin page, it should be something like /admin/plugins/pluginname. If that is giving a 404 that means your plugin isn't being loaded properly on startup. Check nodebb logs for any errors / warnings. The quick start plugin creates a route at /admin/plugins/quickstart https://github.com/NodeBB/nodebb-plugin-quickstart/blob/master/library.js#L37
  • Override/Extend Client-Side Core Search Module

    Solved
    6
    0 Votes
    6 Posts
    400 Views
    W
    @baris Just found the root cause of the weird behaviour! Turns out that there is a bug in my NodeBB dev startup scripts. One of the steps involves automatically symlink plugin packages for a more seamless plugin development. The issue happens when the yarn link only happens after NodeBB build but before NodeBB start Thus there is this weird behaviour of the plugin is loaded but its public assets are not built 🫠 Thank you for your pointers and help
  • What and Why this error

    12
    +0
    0 Votes
    12 Posts
    540 Views
    traarrrT
    After a lot tries here and there I have reached the cause of this issue... I cause is some plugins which are not running properly. It is due to this it hinders the compilation of client side JS for all the plugin which loads after that.
  • Clustered NodeBB and plugin socket methods

    7
    0 Votes
    7 Posts
    464 Views
    barisB
    Yeah your flow should work, we don't trigger it on all instances as that would cause issues if the function is doing db writes for example. You would have 2+ instances trying to create the same records etc.
  • Page/route changes

    4
    0 Votes
    4 Posts
    228 Views
    R
    My fault. I wasn't calling ajaxify.go correctly. All works now.
  • Query all the objects by key.

    4
    0 Votes
    4 Posts
    303 Views
    barisB
    I would advise against using those since they operate on fields that are not indexed. If all you want to store is a uid and score pair you can use sorted sets like below. //setting values await db.sortedSetAdd('pluginname:users:customstats', [score1, score2], [uid1, uid2]); // getting first 10 values await db.getSortedSetRevRange('pluginname:users:customstats', 0, 9);
  • A section of my template is not loading (unless I refresh the page).

    3
    1 Votes
    3 Posts
    192 Views
    enbermudasE
    I don't know why, but taking those conditionals checks that I have to the route controller fixed the problem. I don't need to reload the page anymore.
  • Displaying a text box whenever an admin decides to delete an user's topic

    1
    0 Votes
    1 Posts
    130 Views
    traarrrT
    Hi all, Well this is my first time writing a plugin which involves using client side hooks... For a start, i would want my plugin to listen to a hook which activates when the topic page is completely loaded and topic tools are loaded too. For which I wrote this function: 'use strict'; /* globals document, $ */ $(document).ready(function () { function alertType(type, message) { require(['alerts'], function (alerts) { alerts[type](message); }); } console.log('nodebb-plugin-quickstart: loaded'); $(window).on('action:topic.loaded', notifyBox); function notifyBox() { console.log("in notify box"); alertType('success', "done") } }); but this is not working... I can only see "nodebb-plugin-quickstart: loaded" on the console. Where am i going wrong here??