User stats block. Post count by type, etc.

thatnewguy - June 27, 2009 - 13:56

I'd like to create a view of user statistics where posts by content type are listed as well as userpoints and a comment count. I've done some searching regarding this, and tinkered around with views for a while, but I haven't really found a solution. I checked out the user statistics module, but it's focus is too narrow and views doesn't seem to offer a lot in the way of user information for fields.

Basic idea of the stats view:

--------------------
Node A posts: 98
--------------------
Node B posts: 34
--------------------
Node C posts: 122
--------------------
Forum posts: 33
--------------------
Userpoints: 34567
--------------------
Comments: 35
--------------------

The forum posts would have to include comments to the forum node as well as forum nodes themselves...

All in all, I'm getting the impression views doesn't have the capability for this, but I also don't know much about relationships, so maybe I'm wrong? Is this the realm of a block with some custom php code in it or can views handle this?

What do you think?

Performance

Michelle - June 28, 2009 - 21:16

I'm not sure if views can do a group by query, yet, in 2.x. Even if it can, though, this sounds like a performance nightmare to recalculate all of that on every viewing of the block. You'll also run into trouble trying to count nodes, comments, and user points in the same view as they have different base tables. I suggest storing the counts in a table and retrieving it from there. You might want to consider a patch to user stats for per type post counting.

Michelle

---
I'm looking for folks to help me out by posting in my Coulee Region forums. You don't need to live in the area; there's plenty of general forums. But please, no Drupal support questions. :)

 
 

Drupal is a registered trademark of Dries Buytaert.