Skip to content

Plugin Development

Have a question about building a plugin? Ask here
444 Topics 1.9k Posts
  • Upvote Notifications

    3
    2 Votes
    3 Posts
    2k Views
    B
    @exodo said in Upvote Notifications: working without core modifications? Yep. Only lightly tested so far (but based on my previous code that had automated tests written). Next I'd like to figure out how to make automated integration tests for plugins.
  • inline commands @gif

    1
    2 Votes
    1 Posts
    795 Views
    E
    this post should go on plugin request @Global-Moderators Having inline commands on composer like telegram does could be epic like adding new gifs from giphy with @gif command [image: 145219690551151.gif] https://telegram.org/blog/inline-bots anyone up? @3rd-Party-Developers
  • 0 Votes
    1 Posts
    1k Views
    D
    Suppose there are two files. library.js in the /nodebb-plugin-namePlugin file.js in /nodebb-plugin-namePlugin/static/lib Now I must do a lot of operation in my library.js and I must check when user is created. So I use the hook and It's everything ok, but, after I must my check in library I need to send a message to my file.js to change background color of a component. The proble is that I used this to communicate: websockets = module.parent.require('./socket.io'), //library.js websockets.in('uid_' + data.uid).emit('hash', { 'username': data.data.username }); //file.js socket.on('hash',function(){ console.log("DOG); }); The problem is that I don't have data.uid value because I'm checking before that an user can registrate himself. Anyone can help me to use websocket without uid or can suggest me other methods?
  • [nodebb-plugin-embed-imgur] Embed Imgur

    3
    2 Votes
    3 Posts
    2k Views
    S
    @a_5mith This plugin in great! But I couldn't find this in the Download Plugin page? How to bring it back?
  • This topic is deleted!

    4
    0 Votes
    4 Posts
    108 Views
  • Composer Button Tooltips

    3
    0 Votes
    3 Posts
    2k Views
    NedFodderN
    @baris Just tried out 3.0.27, works great, thanks! There's still one difference: with filter:composer.formatting the text is run through the translator automagically, but with composer.addButton() I have to translate it first. Not a big deal, just pointing that out...
  • Need to hook to /api/user/username/topics .build

    3
    0 Votes
    3 Posts
    2k Views
    Fredrik MelénF
    Thank you very much! Awesome! @yariplus
  • Social Share Callback

    Unsolved
    8
    0 Votes
    8 Posts
    4k Views
    N
    @PitaJ I think their JS SDK support, i tried googling. They have the share function with response id as callback. We can check for the response id to check if the content is actually shared.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    15 Views
  • This topic is deleted!

    2
    0 Votes
    2 Posts
    41 Views
  • NodeBB Plugin best practices

    1
    1 Votes
    1 Posts
    1k Views
    PitaJP
    I'm thinking it would be good if we establish some best practices for NodeBB plugin development. Feel free to contribute by replying and I'll add it to the list. Database keys should start with plugin:[your-plugin-name]: ex: if the plugin is nodebb-plugin-mentions then the database keys would start with plugin:mentions: Use sockets instead of ajax Use CSS transitions instead of jQuery animations, trigger them by toggling classes on the elements Use Bootstrap elements as much as possible or not at all your suggestion here
  • nodebb-plugin-sso-steam-refactor

    3
    0 Votes
    3 Posts
    2k Views
    H
    Of course, however I just felt more comfortable trying to understand what each line of code did! This was more of a learning experience ~
  • how to access meta.config.maximumFileSize in plugin client side js?

    2
    0 Votes
    2 Posts
    1k Views
    barisB
    It is available in the client side config object. You can use it as config.maximumFileSize
  • Async problem in async.each

    2
    0 Votes
    2 Posts
    1k Views
    yariplusY
    You need to use async.map, which creates the new array based on the old one. function(setUsername,next){ async.map(setUsername, function(uid, call) { db.getSortedSetRange(set + uid, start,end, function(err, test) { // You need to ignore errors here, and just mark test as null. if (!test) test = null; // The callback will push to the new array. call(null, { 'uid': uid, 'test': test }); }); }, function (err, array) { if (err) { next(err); } // Filter out empty values. array = array.filter(function(el){ return el.test; }); next(null, array); }); }
  • This topic is deleted!

    6
    0 Votes
    6 Posts
    16 Views
  • Error when import database,etc.in a support's file

    1
    0 Votes
    1 Posts
    721 Views
    D
    I need to use in my controllers.js the value of function that I write in another file utils.js. The file "utils.js" in the same folder (lib) of my controllers.js. So in my controllers I import the file utils.js with this: var utils=module.require('./utils'); and I import database in the file utils.js in this way: var db = module.parent.parent.require('./database'), That is the same import that I use also in my controllers.js. But I obtain "cannot find module ./database" in my utils.js . Anyone can help me?
  • How to get Chat Name from Websocket?

    5
    0 Votes
    5 Posts
    2k Views
    A
    @baris said in How to get Chat Name from Websocket?: There is a method to get the raw content of a message by its message id interestingly so does sockbot although i recon the two different methods serve rather different purposes. @baris said in How to get Chat Name from Websocket?: there is no method to load all the data of a message yet. ah. trhen my interface shall throw E_UNSUPPORTED for now until a certain vixen makes a PR to fix that.
  • Error when I save a particular format of data[mongo db]

    2
    0 Votes
    2 Posts
    4k Views
    frissdiegurkeF
    you need to wrap it like {"value": [{"uid":1,"name":["Andreas"]}]}. Arrays are no (direct) instances of Objects; Thus not allowed to be used within db.setObject. EDIT: Actually [] instanceof Object === true. It's just not allowed by the database clients since Arrays are no conventional key/value stores.
  • How to get the website url

    4
    0 Votes
    4 Posts
    2k Views
    julianJ
    @lewismcmahon There's no way to know what the full url is besides what's presented in config.json, since multiple URLs can point to the same NodeBB. The nconf solution is the easiest.
  • Problem with database when I try to get UserData

    1
    0 Votes
    1 Posts
    714 Views
    D
    I update my version of nodebb four days ago.In my program i try to get data for user so I use in my (controllers.js): var db = module.parent.parent.require('./database'), ......// in a method db.getUserData(uid, function(err, user) { if (err) { return err } //the problem is that if I use db.setObject or other method, db variable works // but in this case give me TypeError: Object #<Object> has no method 'getUserData' at async.waterfall.input.username Maybe in the new versione is changed something? Anyone can help me?