How to get user data in partials/topic/post.tpl ?


  • Translator

    Hello there!
    I want to hide arrows up and down from users, which have reputation less than x.
    How to get logged in user object with his reputation in partials/topic/post.tpl?


  • Plugin & Theme Dev

    I think to do this, you'd better hook "filter:post.upvote", check user's reputation, then return error info if not satisfied.
    This hook source code is at file socket.io/posts/helpers.js.

    See NodeBB how to do this for not-enough-reputation-to-downvote in src/posts/votes.js:

    if (command === 'downvote' && parseInt(results.reputation) < parseInt(meta.config['privileges:downvote'], 10)) {
        return callback(new Error('[[error:not-enough-reputation-to-downvote]]'));
    }
    

Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.