How would I get the points of the poster to display on comment/node.tpl.php. Thanks!

Comments

kbahey’s picture

Component: Code: userpoints_basic » Code: userpoints API
Status: Active » Fixed

You can find something very similar here: How To: displaying userpoints below avatar/user picture.

If you change node.tpl.php or comment.tpl.php instead then you get what you want.

Flying Drupalist’s picture

Status: Fixed » Active

Hi, that code causes the user picture to display as a link instead of actual picture.

Also can you return the currency name after the points number. So it says # points, not just #. Thanks.

jredding’s picture

Status: Active » Fixed

in comment.tpl.php you have access to the author of the comment or the node (respectively).

In order to display the points you would do as the following post stated; which is
comment.tpl.php

 <?php print userpoints_get_current_points($comment->uid); ?> 

node.tpl.php

 <?php print userpoints_get_current_points($node->uid); ?> 
jredding’s picture

to return it with the appropriate "point" wording.. do the following

<?php 
  $points =  userpoints_get_current_points($node->uid); 
  print format_plural($points, '!point', '!points', userpoints_translation());; 
?>
Flying Drupalist’s picture

Thanks, that works as desired. :)

kbahey’s picture

We also need to get this done at some point. It will be more convenient to display points consistently across the site from just one place http://drupal.org/node/310737

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

lelizondo’s picture

subscribing

kpv_dnepr’s picture

One more time) How would I display userpoints on node.tpl.php for this node, not for user. Thanks!

kbahey’s picture

Do not comment in closed issues.

Also, your question is meaningless. The points are attached to users, not to nodes.