Plugin Help

NodeBB Plugins
  • Hi NodeBB team,

    I'm learning JS by writing what seemed to me a simple plugin. Knowing nothing of this matter I'm struggling a little with this all dispached structure.

    I've succeed to make basic routes so far. I'm working now on the template of the admin page.

    I have added these

    <!-- IF emailerInstalled -->
    <!-- ELSE -->
    <!-- ENDIF emailerInstalled -->
    

    but doesn't seem to be recognized, always getting the false condition.

    Could someone point me the right direction?

    I wonder also if adding a "post" route is the right way to get the form back? I've seen this from imgur plugin.

    nodebb-plugin-admin-email


Suggested Topics


  • 0 Votes
    7 Posts
    3k Views

    Yes, as @Schamper recommends, do not use relative paths to break out of the plugin's root directory, just use module.parent.require to require from the context of plugins.js, or require.main.require to require from the context of app.js

    To answer OP, I use npm link to link my folders together. I have one big messy NodeBB install ( 😉 ) and next to it is a plugins/ folder where all the plugins live.

    @psychobunny integrated grunt into NodeBB, so I just use grunt --verbose to develop now, instead of ./nodebb dev 😄

  • 0 Votes
    4 Posts
    2k Views

    I am writing like plug-in, which provides an like functionality for anonymous as well as registered user.
    1. Anonymous User should be able to like on any comment/reply and I have to restrict anonymous user via IP address.
    Yet, I can store IP values to redis database, I need to find out, The given IP value is present in "like:pid" hash set.
    I need to write query structure which finds out the given anonymous users IP address is not present in database for that particular post.

    Thanks!!

  • 0 Votes
    1 Posts
    1k Views

    I am wanting to add some fields to the registration page, so I thought I'd write a plugin for it.

    It looks like the process would be:

    Add a 'filter:register.build' hook function to insert the html for the extra form inputs. Add a 'filter:user.custom_fields' function to insert the key/value to the userData object.

    I looked at the spam-be-gone plugin to get an understanding of how to go about it, but my question is: Is it possible to place my added field(s) at the top of the form -- or anywhere else -- rather than the bottom?

    I can also do this by adding my additional html into the register.tpl file and then adding the key/value to the userData object in /src/user/create.js, but I'd rather do it via a plugin as it seems cleaner. I don't need the data to appear on the site (i.e. the user's profile) so just these two things work fine.

    The problem is I believe I'd have to do a 'git pull --rebase' each time I wanted to get updates for nodebb which could break things over time. Seems hacky. Plus, it is more maintainable to keep my modifications modular.

    So, is there a better way? What's the best way to go about doing something like this? I'm just assuming that doing it via a plugin would be ideal, but if there are better options that are clean, then please let me know.

    Lastly, if I wanted to have a function run a check on this info for duplicates during the registration (exactly like the one for username) can you steer me in the right direction on how I'd go about it?

    Thanks!

  • 3 Votes
    87 Posts
    39k Views

    Makes sense. Very well 😛, I approve.

  • 4 Votes
    44 Posts
    23k Views

    This is not working anymore on my NodeBB 1.10.1 and 1.10.2.

    The page in ACP does not work anymore.