How get all bookmarks from a user

  • GNU/Linux

    I need to get all bookmarks that an user create. So I think to use this function:


    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?

  • NodeBB

    You can use /api/user/<userslug>/bookmarks

  • GNU/Linux

    @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?

  • NodeBB

    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.

  • GNU/Linux

    @baris Thanks for you suggest. But in my nodebb version(1.2.1) there isn't this function maybe it is an update from new version ?

  • GNU/Linux

    @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:


Suggested Topics

| |