Skip to content

Plugin Development

Have a question about building a plugin? Ask here
437 Topics 1.9k Posts
  • 0 Votes
    2 Posts
    335 Views
    barisB
    See this topic for breaking changes in 1.19.0 https://community.nodebb.org/post/86172. You can rename middleware.authenticateOrGuest to middleware.authenticateRequest
  • 1 Votes
    7 Posts
    578 Views
    dave1904D
    @baris said in Exclude ignored Topics from Recent Topics widget (nodebb-widget-essentials): Do you have category ids defined in the widget settings? Yes I do, that makes it clear. I'm thinking about the best way to implement your mentioned filtering. for(int i = 0; i < cids.length; i++) { const isIgnored = await categories.isIgnored(cids[i], widget.uid); for(int j = i; j < isIgnored.length; j++) { if(isIgnored[j]) { // remove from cids array? } } } I know there is an Array.filter() function so I'm pretty sure there is a better/easier way?
  • 0 Votes
    6 Posts
    511 Views
    barisB
    Please open an issue on our github tracker, I am not sure if we should just remove the saving to user settings in the sort dropdown all together and move the sort settings to /user/<slug>/settings like everything else. Then you can change the sort order in every topic without effecting your settings. The setting used in the user page would be the default sort when you enter a topic.
  • Unread Count on Custom Navigation Item Icon

    Solved
    2
    0 Votes
    2 Posts
    268 Views
    yasasY
    Update: Was able to sort this with a client script. Example usage: plugin.json -> { "hook": "filter:navigation.available", "method": "addNavigation" } plugin.json -> "scripts": [ "static/lib/client-script.js",... ], library.js addNavigation: append the following to the hookData object: { route: '<some route>', title: <some title>, id: 'unread-count', iconClass: '<some icon> custom-class-name', text: <some title> } client-script.js: $("#unread-count .custom-class-name").attr("data-content",<unread count>)
  • Unread Topics - View

    Solved
    7
    0 Votes
    7 Posts
    523 Views
    yasasY
    Hi @baris I missed this somehow. Thank you! This is great news. I was creating a custom page but this solves the issue. Thanks very much!
  • Middleware - Correct Usage

    Solved
    10
    0 Votes
    10 Posts
    866 Views
    julianJ
    Wonderful! Glad to help.
  • Schedule / Cron Service in NodeBB

    3
    0 Votes
    3 Posts
    327 Views
    yasasY
    @baris Brilliant! I'll take a look at this. Thanks as always!
  • hide favicon counter

    4
    1 Votes
    4 Posts
    420 Views
    Sebastián CisnerosS
    @baris it worked perfectly. Thanks.
  • Plugin styling not applied when not installed via ACP

    Solved
    3
    0 Votes
    3 Posts
    269 Views
    yasasY
    Hi @baris I tried a less block and now it's all working well. Thanks a lot!
  • This topic is deleted!

    Solved
    5
    0 Votes
    5 Posts
    14 Views
  • Error when importing library

    Unsolved
    7
    0 Votes
    7 Posts
    485 Views
    G
    @baris No error, exept a "not found" on every route of libray.js I feel silly. I hadn't thought to use an older version. It works ! Thank you very much !!!!
  • 0 Votes
    12 Posts
    815 Views
    barisB
    do I have to read the source for each object to learns its methods? Yes, you will have to read the source code to see what methods are available.
  • 2 Votes
    11 Posts
    1k Views
    julianJ
    @Yve-Salazar Are you still looking to distinguish between API calls via curl?
  • 1 Votes
    17 Posts
    1k Views
    Y
    @baris thanks! This was very helpful. @Sebastián-Cisneros and I really appreciate it.
  • app.user.groupTitle shows only one item in array

    11
    0 Votes
    11 Posts
    1k Views
    barisB
    That's not possible out of the box, you would have to write a plugin to set the groupTitle value to all the groups the user is a member of.
  • Template helpers not working in in NodeBB v2

    Solved
    7
    0 Votes
    7 Posts
    924 Views
    magnusvhendinM
    @baris This worked like a charm. Thank you!
  • Unable to override scripts

    Solved
    4
    0 Votes
    4 Posts
    473 Views
    magnusvhendinM
    @julian This worked great. I did this in my main client file (like persona.js). require(['hooks'], (hooks) => { hooks.on('filter:script.load', (data) => { const replaceMap = { register: { target: 'forum/register', with: 'replacement/register', }, }; const replace = replaceMap[data.tpl_url]; if (replace) { const index = data.scripts.indexOf(replace.target); if (index > -1) data.scripts[index] = replace.with; else data.scripts.push(replace.with); } return data; }); }); Then I can just add my scripts that I want to replace to the replaceMap object.
  • avoid nodebb send email notifications if daily digest is on

    5
    0 Votes
    5 Posts
    582 Views
    Sebastián CisnerosS
    I guess the right one is this one filter:email.cancel accodring to nodebb documents const result = await Plugins.hooks.fire('filter:email.cancel', { cancel: false, // set to true in plugin to cancel sending email template: template, params: params, }); right?
  • Composer custom field validation

    14
    0 Votes
    14 Posts
    1k Views
    Sebastián CisnerosS
    @baris Thanks for the help. I appreciate it.
  • ajaxify.data.users not containing all my users

    4
    1 Votes
    4 Posts
    559 Views
    Spin0usS
    Thanks to @julian we finaly found the problem. Here is the pull request. In fact, this bug only occurs when an administrator update a member profile.