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

Moved Technical Support
  • 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?

  • 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

    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]]'));

Suggested Topics