aPaddedCell Article: An Introduction to the User Stats Module for Drupal

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

This is documentation for a Drupal module, so mostly only of interest to Drupal forum admins and what not. I wrote this module to count posts on TWF, so you can see it in action all around you. Smiling

Article summary:

The User Stats module inserts information on a user into their posts on a site. It is aimed at forum administrators who need to see the post counts, date registered and IP addresses of their users. This article provides an introduction to the User Stats module and shows how it may be used in themes.

Here is the link: Introduction to the User stats module.
Post any questions/comments here. If you're seeing a specific problem with the module, you should probably raise a bug/support request, from the project home page.

a Padded Cell our articles site!

She has: 70 posts

Joined: Nov 2007

Note to anyone using the advanced forum module: all you have to do is enable user stats. You don't have to add anything to your theme. Advforum automatically finds and uses it.

Michelle

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Note to anyone using the advanced forum module: all you have to do is enable user stats.

That's just the Drupal six version of Advanced forum isn't it? I should add that to the article, thanks Michelle. Smiling

a Padded Cell our articles site!

She has: 70 posts

Joined: Nov 2007

Nope, that's the D5 version. Actually, I think the D6 version does, too, but I haven't tested it on there. I just copied the function from 5.x as is.

Michelle

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Last time I looked (a few weeks ago) Adv. Forum for Drupal six did use User stats. I thought it was just the six version though.

*** EDIT ***
I've updated the article with a note for Advanced Forum users. Thanks for the tipoff Michelle. Smiling

a Padded Cell our articles site!

She has: 70 posts

Joined: Nov 2007

Hmm... Don't know why that would have been. I add features to D5 and then copy them to D6. At any rate, I know it's there now because I installed user stats on my own site. Smiling

Michelle

They have: 1 posts

Joined: Feb 2009

Michelle,
Is there documentation somewhere explaining how User Stats and AdvForum work together? I have both installed on D5 (both downloaded today 2/23/09). AdvForum seems to work but I get no user stats in my forum anywhere. When I come to this site, I'm told it just works and to refer to the Advanced Forum docs. However, the docs don't say anything about this, that I can find.

Please just point me to something pertaining to User Stats and Advanced Forum specifically.

Thank you!

Jeremy Brooks

They have: 1 posts

Joined: Jul 2008

Great module and nice tutorial.

The only thing I'm having problems with is the formatting of the 'joined' date.

You suggest:

<p>Join Date: <?php print date_format(user_stats_get_stats('join_date', $node->uid), 'custom', 'd/m/Y'); ?></p>

Which I assume changes to $comment->uid when used in a comment.

However, my error message is telling me that "date_format() expects exactly 2 parameters, 3 given in ..."

I tried removing 'custom' but no joy either. Any ideas?

Cheers

James

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Whoops, I meant format_date. Article updated, thanks. Smiling

They have: 1 posts

Joined: Sep 2008

Hello, just installed the module. Nice work.
I do have one bug I can't figure out myself.
I have added the code to the templates, example below:
---------------------------------------------------------------

<?php
if ($submitted || $terms):
?>

<?php
if ($submitted):
?>

<?php
print $submitted
?>
| Post count:
<?php
print user_stats_get_stats('post_count', $node->uid);
?>
| Online:
<?php
print (user_stats_get_stats('online', $node->uid) ? 'yes' : 'no');
?>
| Join date: Join Date:
<?php
print format_date(user_stats_get_stats('join_date', $node->uid), 'custom', 'd/m/Y');
?>

<?php
endif;
?>

<?php
endif;
?>

<?php
print $picture
?>

<?php
print $content
?>

-----------------------------------------------------------------

It looks just like I want it, but there are no statistics with every comment. The text is there but no acutal statistics.

My site is www.360defense.nl. Here you can see it.

As you might see I did not use the tags to keep the format the same as the submitted line.

Any suggestions?

Greetings,
Sanne

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.