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){
      if(err){
        console.log(err)
        cb(null, data)
      }
      category = res
      callback()
    })
    
  • You need to pass in more parameters

    Categories.getCategoryById({
      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