No topics from getCategoryById

Plugin Development
  • I'm using the following code to pull back a category by id. When I use the the api url in a browser topics are included but not when using this method. Am I missing a required piece of data?

    //get category by id
    Categories.getCategoryById({cid: category_id,uid: 0},function(err,res){
        cb(null, data)
      category = res
  • You need to pass in more parameters

      cid: category_id, 
      set: 'cid:' + category_id + ':tids', 
      reverse: false,
      start: 0,
      stop: 19,
      uid: 0
    }, callback);
  • Awesome ty so much 🙂
    I ended up making the call to Categories.getCategoryTopics() but I may switch back to the method you posted above 👍

Suggested Topics

  • scheduling topics

    Plugin Development
    0 Votes
    6 Posts

    @baris Thanks much, your help is always appreciated.

  • 1 Votes
    3 Posts

    @baris Thanks. It worked 🙂

  • 1 Votes
    5 Posts

    I was interested in that functionality as well, so I developed my own version of it.
    It can be found here and already is in nbbpm (can be installed from ACP by searching for nodebb-plugin-category-queue)
    It has some basic ACP (list of categories with options to queue new topics from them or not queue), and only works on new topics, not all posts (that is actually by design, as - after all - you have done the work on filtering posts already. It's just that I was looking for only sending new topics to queue)

  • 0 Votes
    4 Posts

    @PitaJ I think I found a way, I use client-side on 'action:ajaxify.end': components.get('topic').append(html) where html is the parsed (by jQuery) element I want to show.

    If there is a way to do that server side instead of client side, I would really appreciate if you let me know 😂

    And also I don't really get how can I understand what every hook method takes as parameters, when I click on one of them in the hooks list on GitHub, it just show me a line of code, and I don't get what that line means (for example in goes where there is an if statement, what that means?)

  • 0 Votes
    3 Posts

    Wow awesome, that seems to have done the trick 👍

    Thank you so much for the help.