Skip to content

Plugin Development

Have a question about building a plugin? Ask here
425 Topics 1.9k Posts
  • 2 Votes
    2 Posts
    3k Views
    ogerlyO

    i have added Dailymotion and Vine

    Link Preview Image GitHub - ogerly/nodebb-plugin-embed-videos: youtube, vimeo, facebook, dailymotion, vine

    youtube, vimeo, facebook, dailymotion, vine. Contribute to ogerly/nodebb-plugin-embed-videos development by creating an account on GitHub.

    favicon

    GitHub (github.com)

  • Custom PHP Page

    30
    0 Votes
    30 Posts
    15k Views
    yariplusY

    Sure, you do that where you declare your custom route.

    function renderSink(req, res, next) { if (!req.uid) return res.redirect('/login'); // Do normal stuff. res.render('demo', someData); } module.exports = function(app, middleware, controllers) { app.get('/demo', middleware.buildHeader, renderSink); app.get('/api/demo', renderSink); };

    More info here: http://expressjs.com/4x/api.html#res.redirect

  • nodebb-plugin-youtube-lite

    4
    0 Votes
    4 Posts
    2k Views
    ogerlyO

    @ogerly said:

    <a href="http.?:.*(youtube.com|.*be/|.*embed/|watch?. v=|(\w{11})). ?</a>

    Link Preview Image regex101: youtube link + id +

    Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.

    favicon

    regex101 (regex101.com)

  • nodebb-plugin-fb-video

    1
    0 Votes
    1 Posts
    1k Views
    ogerlyO

    with the plugin you can videos of facebook
    display in NodeBB.

    Example URL:
    https://www.facebook.com/zuck/videos/vb.4/10101993274698321/?type=2&theater

    ! it loads very slow for large videos!

    Bildschirmfoto vom 2015-07-31 14:44:05.png

  • nodebb-plugin-prezi

    1
    2 Votes
    1 Posts
    1k Views
    ogerlyO

    Hello
    I made my first plugin.

    I have a youtube-lite plugin taken as a basis.

    with the nodebb plugin Prezi presentations can be integrated by http://prezi.com.

    git: https://github.com/ogerly/nodebb-plugin-prezi.git

    npm : https://www.npmjs.com/package/nodebb-plugin-prezi

    Bildschirmfoto vom 2015-07-31 13:52:30.png

  • Send attachments through Chat

    2
    1 Votes
    2 Posts
    2k Views
    agd1A

    Still new to NodeBB, but I think the chat is handled by Redis/MongoDB. While you can store files in MongoDB using GridFS, I would think a great way to tackle that would be to have the plugin upload the file to storage (like AWS S3) and then include in the body of the message a link to the downloaded file. Permissions could be set at upload to only allow members of the chat access to the file.

    I would also be very interested in this feature!

  • 0 Votes
    7 Posts
    2k Views
    epidemiya30E

    I mean exclude from excluding the plugin folder ๐Ÿ™‚

  • Different entity for "Topic"

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    julianJ

    Would the Q&A plugin be closer to what you want?

  • Retrieve setting value from the client side

    4
    0 Votes
    4 Posts
    2k Views
    R

    Always makes me smile when I can help.
    Your plugin also opened nodeBB to a more scientific audience, which I personaly find extra apealing. ๐Ÿ™‚

  • Refresh Required when Posting to /login

    6
    0 Votes
    6 Posts
    2k Views
    O

    Yep, and that's indeed what I've ended up doing. It doesn't feel as nice as it could be but it will do.

  • Bootstrap widget render with data

    4
    0 Votes
    4 Posts
    3k Views
    P

    Like this?

    Link Preview Image nodebb-widget-essentials/public/templates/widgets/activeusers.tpl at master ยท NodeBB/nodebb-widget-essentials

    Several basic widgets bundled together in one package including 'HTML', 'Markdown', 'Recent Replies', 'Active Users', and 'Moderators' - nodebb-widget-essentials/public/templates/widgets/activeusers.tpl at master ยท NodeBB/nodebb-widget-essentials

    favicon

    GitHub (github.com)

    This pre-renders the list of active users from server data. And then has some inline JS with socket call to update the list as new users become active

  • How to update each X seconds a widget?

    6
    0 Votes
    6 Posts
    2k Views
    yariplusY

    @Fez-Vrasta You have to include it. e.g. var SocketIO = require('./socket.io');

    I'm not sure if there is an option for per widget client js. I put it in my main client.js in my plugin.json.

  • How to debug a plugin in nodebb

    3
    0 Votes
    3 Posts
    2k Views
    xinshoukeX

    https://github.com/justmepzy/nodebb-plugin-aliyun-oss, this plugin doesn't work totally.

  • Fill missing user fields on SSO login

    1
    0 Votes
    1 Posts
    979 Views
    A

    Hi! I'm trying to make another SSO plugin, but the difference is: i want user to fill missing fields (like email) after external authentication but before user is created in the forum.

    The only good solution i see is to override successReturnToOrRedirect andfailureRedirect fields to custom routes (https://github.com/NodeBB/NodeBB/blob/master/src/routes/authentication.js#L60), which are handled by plugin itself, to render input forms and logic. So i think it would be nice to extend login strategy with success/fail routes and use them if specified.

    I would like to hear opinion about my idea. If it is good enough i think i can create pull request.

  • Widget doesn't render

    5
    0 Votes
    5 Posts
    2k Views
    Fez VrastaF

    AHHH!!!! THANK YOUUU!!!!

    What a stupid error ๐Ÿ˜ž

    thanks!

  • Share information between plugins

    8
    0 Votes
    8 Posts
    3k Views
    A

    I've used hook method in my bbcode plugin (watch Extension block here - http://forum.apxeolog.com/topic/8/nodebb-bbcode-plugin)
    It is greate since:

    If there is no 'parent' plugin there will be no errors (noone call the hook) Plugin priority dosn't matter because hooks should be called after all plugins are loaded
  • Plugins not displaying in Admin console

    10
    1 Votes
    10 Posts
    5k Views
    barisB

    Yeah nodebb plugins are npm modules so they need to have a package.json file. The plugin.json file is just for nodebb.

  • User Permissions

    4
    0 Votes
    4 Posts
    2k Views
    snodejokeS

    Thanks a lot @baris.

    I'll investigate this route.

  • Searching for users on custom fields

    4
    0 Votes
    4 Posts
    2k Views
    yariplusY

    @snodejoke

    Hey, yeah. I've been meaning to reply as well. What I typed above was actually and older 0.6.0 way of searching, and it doesn't actually work the way you want anyway.

    From what I can see, there is no way to search for custom fields using users.js

    It seems the proper way of doing would be to add a sorted set value when you create the field. If the field is a number, something like db.sortedSetAdd('users:yourfield', yourfield, uid, callback) then lookup with db.getSortedSetRangeByScore('users:yourfield', 0, count, min, max, callback), that's how I do it in my plugins now.

    If it's not a number, you need to store it as db.sortedSetAdd('yourfield:sorted', yourfield + ':' + uid, callback) then lookup with db.getSortedSetRangeByLex('yourfield:sorted', min, max, 0, count, callback)

    Here's how I sorted a custom field on my forum without creating a sortedset if you're interested:

    // Get all uids db.getSortedSetRange('users:joindate', 0, -1, function (err, uids) { // Get their custom_field User.getMultipleUserFields(uids, ['uid', custom_field], function (err, users) { // Sort by custom_field async.sortBy(users, function (user, next) { return next(null, user.custom_field); }, function (err, results) { console.log(results); }); }); });

    If not all users have the field, you can use the 'filter:users.get' hook to filter user results to only users that have the field, like I had to do.

    Hooks.filterUsersGet = function (users, next) { // If 'custom_field' isn't in the results, don't filter. if (users && users[0] && users[0].custom_field !== void 0) { // Filter it out if it's null. async.filter(users, function (user, next) { return next(user.custom_field !== null); }, function (results) { next(null, results); }); }else{ next(null, users); } };

    Result:

    [ { uid: '18', uuid: '069a79f444e94726a5befca90e38aaf5' }, { uid: '4', uuid: '294ecf637f1242c6a95d9cf8cc6da3ef' }, { uid: '3', uuid: '32a46cc646d64ffea4da962692858288' }, { uid: '5', uuid: '621ad5087ed448dd92dbc83950a222d9' }, { uid: '17', uuid: 'a85e5f36dc5e465d9c86c6ad88912e99' }, { uid: '1', uuid: 'f19cb1605bc24838835a07757d60ce80' } ]
  • action:categories.loaded only on infite scroll

    1
    0 Votes
    1 Posts
    1k Views
    R

    Hi!

    I want to alter the category listings, namely the links to each topic.
    There I noticed that action:categories.loaded|loading both trigger on scrolling, only. Neither on the initial visit (when loading the first X topics) nor when pagination is used.

    I am about to use an ajaxify hook and check for the url; just want to make sure that there's no other, maybe better way to do this, is there?
    I wouldn't need any data, just to know the fact, that the user is in a category/topic listing.

    edit:
    Uhm; noones signature is showing in posts. Did I miss that before?

    Thanks ๐Ÿ™‚
    r๐Ÿบ