How get all bookmarks from a user
-
I need to get all bookmarks that an user create. So I think to use this function:
Topics.getUserBookmarks(tids,uid,callback);
But I think is not the best solution because I must request firt all topic create in forum. Anyone can suggest me any other best solution or way?
-
@baris I'm new about nodebb. On your advice I don't know what I have doin, I do this:
in my library.js:
hostMiddleware = params.middleware, hostControllers = params.controllers; router.get('/api/user/:userslug/bookmarks', controllers.renderAPIBookmark);
But I don't know how take parameter in my
Controllers.renderAPIBookmark = function(req, res, callback) {}
Or do you mean a REST call or:
$.getJSON('/api/user/admin/bookmarks', function(data){ console.log("IN MEZZO AL NULL"+data.result); });
what do you mean?
-
Oh I thought you needed them client side, if you need to grab the post ids a user has bookmarked you can use this.
db.getSortedSetRevRange('uid:' + uid_of_user + ':bookmarks', 0, -1, callback);
Take a look at this file for how those pages are rendered. https://github.com/NodeBB/NodeBB/blob/master/src/controllers/accounts/posts.js#L16-L26
-
@baris and in the version like 1.2.1 how I can do ( I can't upgrade to 1.3.0) ? Because if I use
db.getSortedSetRevRange('uid:' + uid_of_user + ':bookmarks', 0, -1, callback);
It's not work in the 1.2.1 maybe I can use:
db.getSortedSetRange('uid:'+uid+":favourites",callback);?