User information in comments

They have: 1 posts

Joined: Nov 2014

Hi from newbie!

How have You placed information in user comments, like posts count, registration date? Is this user_stats module (I came from it). Please learn me!

I'm trying set views block in comments but cann't configure contextual filter to show user info in comments.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

I can't find the thread offhand, but this is not a case of regular comments, it is a specific system designed to work as a Bulletin Board

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Kaztur is using our user stats module, which was written for this forum.

Sorry I didn't get back to you sooner! There is a way to embed the stats in your template files. Are you on Drupal 6 or 7? In Drupal 6 we are using this:

      <?php print t('<p>!pronoun: !post_count</p> <p>Joined: !join_date</p>',
        array(
         
'!pronoun' => str_replace(
          array(
         
'Female',
         
'Male',
         
'none',
         
'0'),
          array(
         
'She has',
         
'He has',
         
'They have',
         
'They have'), _user_stats_gender($comment->uid)),
         
'!post_count' => l(number_format(user_stats_get_stats('post_count', $comment->uid)) .' posts', 'user/'. $comment->uid .'/track'),
         
'!join_date' => format_date(user_stats_get_stats('join_date', $comment->uid), 'custom', 'M Y'),
        ))
     
?>

And that renders the "He has: 2,116 posts/Joined: Nov 2003 " as you can see under Greg's photo above.

At first glance that should work in Drupal 7 too (I think ... I'm not sure if or how the user stats module has changed for Drupal 7).

Please let us know if you have any more questions!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.