Skip to content

Plugin Development

Have a question about building a plugin? Ask here
437 Topics 1.9k Posts
  • Calendar plugin evades private forum plugin

    1
    0 Votes
    1 Posts
    219 Views
    E
    See GitHub for reference, https://github.com/LM1LC3N7/nodebb-plugin-private-forum/issues/4#issuecomment-1034840197 Wondering if anyone has an idea why the calendar page is accessible when not logged in while using the private forum plugin.
  • Replacing core language key value

    3
    0 Votes
    3 Posts
    397 Views
    W
    @PitaJ No errors, I redid it from scratch and it worked, I must have done something wrong. Thank you.
  • How to call API from client side.

    3
    0 Votes
    3 Posts
    562 Views
    Sebastián CisnerosS
    @PitaJ said in How to call API from client side.: require(['api', 'translator'], (api, translator) => { // Your code here }); genius! and fast reply!
  • Do not install plugin "nodebb-plugin-sso-beer-qq"

    1
    1 Votes
    1 Posts
    342 Views
    A
    After install "nodebb-plugin-sso-beer-qq", my server crashed and nginx return code 502. After reset all plugins, my server is back to normal again.
  • Hook on the server or client side?

    Solved
    2
    0 Votes
    2 Posts
    503 Views
    barisB
    Hooks that are fired on the server side are only available for use for plugins in their server side code. Same for client side hooks they are only available for use in the client side code of plugins.
  • javascriptEnabled set to true

    2
    0 Votes
    2 Posts
    289 Views
    julianJ
    @tobiasdossinger The real question here is why you need javascript enabled... I am 95% certain you came here because maybe a theme of yours you have suddenly stopped working, with a cryptic error about turning javascriptEnabled on, yes? In that case, you may want to audit your theme and figure out what exactly needs javascript in your LESS... there really is no reason to that I have come across... although I could be mistaken. In Persona's case, it was the .opacity() mixin, which was not required anymore, as opacity is well supported cross-browser now: https://github.com/NodeBB/nodebb-theme-persona/commit/e14d38b827591c9681a5fcd43ca4b206297eaff5
  • Get req username in server-side

    Solved
    4
    0 Votes
    4 Posts
    548 Views
    barisB
    You need to make your controller async for it to work. init: async params => { RouteHelpers.setupAdminPageRoute(params.router, '/admin/plugins/myplugin', params.middleware, [], async (req, res) => { res.render('admin/plugins/myplugin', { username: await User.getUserField(req.uid, 'username') }) }) }
  • Update user profile image

    2
    0 Votes
    2 Posts
    578 Views
    barisB
    I suggest using user.updateProfile to make these changes, since it updates the necessary sorted sets for email/fullname. You can use the same function to update the picture url as well. await User.updateProfile(callerUid, { uid: targetUid, uploadedpicture: url, picture: url, }, ['uploadedpicture', 'picture']);
  • custom plugin with custom POST url

    2
    0 Votes
    2 Posts
    613 Views
    julianJ
    @sebastián-cisneros In static:api.routes, you'll want to call controllerHelpers.setupAPIRoute to mount the route to the appropriate /api/v3/plugins mount point. You can see an example of how we do it in the quickstart plugin
  • How to use with require in admin.js

    Solved
    3
    0 Votes
    3 Posts
    499 Views
    Y
    @julian thanks! I successed with plugin socket https://community.nodebb.org/post/76984
  • 0 Votes
    4 Posts
    679 Views
    PitaJP
    You can set the templates directory to anything in plugin.json, I think it defaults to just templates if you don't specify. https://github.com/pitaj/nodebb-plugin-calendar/blob/4368fdca0ef99336fde9875ab600349a5b13e59c/plugin.json#L26 Them you match the path from views, so it would be templates/emails where you put them.
  • 0 Votes
    4 Posts
    592 Views
    barisB
    Yeah if you put the tags in the content of the posts they will get indexed and search should find them, keep in mind the body of the posts are searched when you search in "posts" so if you are only searching for titles they wont show up.
  • 0 Votes
    2 Posts
    431 Views
    barisB
    Yes, every page has a build hook based on the template it renders filter:<templateName>.build. In your case it would be filter:account/topics.build
  • A plugin that creates CSS

    10
    0 Votes
    10 Posts
    1k Views
    DownPWD
    arf doesn't work. Possible to update it for last version ? @volanar @julian @psychobunny
  • Storing only hashed email

    Unsolved
    7
    0 Votes
    7 Posts
    784 Views
    Nir SN
    Thanks! I guess I can hook to action:user.email.confirmed for reading the existing email and then replacing it with a hashed version. However, password reset wouldn't work since it wouldn't find the uid for the (non hashed) email address provided (here). We can add a hook for preprocessing the email before looking for the uid, but that won't be enough since later the email is sent according to the email field in the db (i.e. not the email provided by the user when asking to reset). One possible solution is: Add a hook for preprocessing the email used for getting the uid. Pass the provided email in params to emailer.send (here) like it's done for welcome and email verification. And here instead of checking that for the template check if params.email is defined. Does that make sense?
  • Custom email validation

    10
    0 Votes
    10 Posts
    971 Views
    Nir SN
    @baris @baris Thanks guys. It's working well.
  • Unable to load template

    18
    1 Votes
    18 Posts
    2k Views
    gotwfG
    @magnusvhendin Settings->Advanced User Obligatory reading: https://github.com/gorhill/uBlock/wiki/Advanced-user-features Although it still does allow some stuff I'd rather not see, on balance I tend to favor "Medium Mode" : https://github.com/gorhill/uBlock/wiki/Blocking-mode:-medium-mode Once you're "in the advanced user" modes, enable various "noop" rules to season to taste. Speaking of which, you probably also should read up "Dynamic Filtering": https://github.com/gorhill/uBlock/wiki/Dynamic-filtering For those more visual and auditory learners: youtuber link: https://www.youtube.com/watch?v=2lisQQmWQkY Have fun! o/
  • Composer quick search see more results

    3
    0 Votes
    3 Posts
    606 Views
    barisB
    That should work but I added a helper to make this easier. https://github.com/NodeBB/nodebb-plugin-composer-default/commit/7c15eeb85b6d702e0a4a3f6519e03af0208c3342 You can all this from your hook $(document).ready(function() { $(window).on('action:ajaxify.end', function(ev, data) { require(['composer'], function(composer) { composer.minimizeActive(); }); }); });
  • grunt "ad-hoc compilation" for multiple instance installation?

    3
    0 Votes
    3 Posts
    397 Views
    B
    @pitaj It's an issue of preference I guess. I'd like to avoid grunt being a dev tool forcing me to deviate from my integrations needs. If grunt would support multiple instances, it would be great and I'd use it. Else I'd stick with the current big hammer method of always recompiling unconditionally and restarting nodebb afterwards. Accepting the additional penalty of nginx rev proxy streaming timeouts. Not elegant but it works.
  • Plugin development 2021 updated - environment and dev workflow - request

    18
    0 Votes
    18 Posts
    4k Views
    B
    @gotwf said in Plugin development 2021 updated - environment and dev workflow - request: Like all powerful tooling, Emacs doe have its learning curve. But it is free and pretty much does any and everything. .. and even coffee. As does vim with a couple of bundles. This is what I'm used to and also working with on nodebb. It's just that you have to pick one and try it or learn how to do it.