I use the User Points module. Despite of my searches, I didn't find answer to this question:

In the user profile of a comment, how to show the number of user points?

For example to show the number of points below the picture of the user who posted a comment.

Any suggestions?


User Points

  • Services integration: allowing retrieving and updating points on your site using web services.
  • Rules integration
  • Views integration
  • A block displaying the number of points a user has gained
  • A block displays the top users who earned points
  • A status message telling the user how many points were earned/lost and their total points
  • A detailed point total report for each individual user
  • A point total report for all users


  • The module is aimed to provide a simple, but extensible solution providing a similar end user interface like the core profile module
    by default.
  • Multiple profile types may be created via the UI (e.g. a general profile + a customer profile), whereas the module provides separated
    permissions for those.
  • Optionally, profile forms are shown during user account registration.
  • Similar to the deprecated core profile module, fields may be configured to be private - thus visible only to the profile owner and administrators.
  • By default the UI behaves similar to the deprecated core profile module, thus showing each profile type in each own tab below
    user//edit. Via the included "Profile pages" module profiles can
    be viewed and edited at their own page and get their own menu link,
    e.g. "My profile".
  • Thanks to the foundational entity API the module integrates well with Rules as well as Features - thus profile types and the associated fields can be exported into feature modules. Once the Entity tokens module (part of the Entity API) is turned on, there are also token replacements available.
  • You may use Views and/or the Search API to provide listings or searches for profiles
  • hi Adi, thanks for your answer. But i just want the number of points in user profile comment (as on stackexchange, the reputation of the users appears in comments). It isn't too much to install a module for that? – Drestez Sep 11 '15 at 8:16
  • you can display it on node using profile 2 module – Adeel Nawaz Sep 11 '15 at 8:54
  • Sorry but I do not see how display it with profile2... Another solution? I would have to add a field in the display of comments, and there are no additional features with regard to what is proposed by default (for information I use drupal 7) – Drestez Sep 11 '15 at 14:44

Your question is similar to what is done in the Answers module (which comes with the Answers Userpoints sub-module that integrates with the User Points module). The newest 7.x-4.0 version of Answers also comes with the (new) Answers Theme sub-module, which you can see at work in this example question. Note the "points" that are shown below each author (user) to the left of a question or answer, which is similar to the "user profile of a comment" in your question.

These points are shown via what you can see in this template file (used for nodes of type "Question"), the template used for nodes of type "Answer" is similar. Both templates are part of the Answers Theme sub-module. More specifically both templates have a line that looks like so:

<?php print userpoints_get_current_points($node->uid); print ' ' . t('points'); ?>

So to complete the answer to your question, this is how you can get it to work:

  • Use a template related to the comments where you want to show the user points.
  • Add a line similar to the code above, using userpoints_get_current_points and replace $node->uid in it by the user id of the user who posted the comment.
  • Refer to the documentation about userpoints_get_current_points if you need more details.

Disclosure: I'm a co-maintainer of Answers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.