Register a hook but lose another hook

Solved Technical Support
  • Okay, so I'm experiencing something weird here.
    First thing first, my repo:

    I got 2 hooks in my plugin.json:

    "hook": "filter:privileges.topics.get", "method": "onGetTopicPrivSettings",
    "hook": "static:api.routes", "method": "addRoutes"

    These hooks are served by /lib/theme.js.
    The problem is:

    • If I register static:api.routes, the hook filter:privileges.topics.get will not register.
    • If I don't register static:api.routes (aka remove from plugin.json), filter:privileges.topics.get will be registered.

    Can someone please tell me what's going on? Why can't I register both static:api.routes and filter:privileges.topics.get?

  • Each hook definition needs to be in a separate object, right now they're all in the same one so only the last is used.

    You need to have something like:

    { "hook": ..., "method": ... },
    { "hook": ..., "method": ... },
  • Thank you so much. And I spent my afternoon debugging this, feeling so stupid right now 😄

Suggested Topics

  • 0 Votes
    5 Posts

    @julian Thanks, my problem is solved.👍

  • 0 Votes
    1 Posts

    Moved things by my managements request to be externally managed users only. But there are a large number of postings for a few local users that would like to be moved. I tried doing some database edits with mongodb, but was not successful in changing the UID of a posting. Anyone have a method for this? Thank you from a Nodebb nuwbie.

  • 0 Votes
    6 Posts

    The issue got fixed by itself now

  • 0 Votes
    5 Posts

    @baris thank you very much! Much appreciated.

  • 1 Votes
    1 Posts

    When trying to boot NodeBB on new server i get

    at Function.MongoError.create (/home/***/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:31:11) at /home/***/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:754:66 at Callbacks.emit (/home/***/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:95:3) at null.messageHandler (/home/***/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:243:23) at Socket.<anonymous> (/home/***/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:262:22) at Socket.emit (events.js:107:17) at readableAddChunk (_stream_readable.js:163:16) at Socket.Readable.push (_stream_readable.js:126:10) at TCP.onread (net.js:538:20)

    Any tips on best practices for migrating servers?