[support] forum stats

Cyberswat cyberswat at gmail.com
Thu Apr 12 18:41:40 UTC 2007


Can't tell for sure because I don't have test data to play with but I think
this will give you a count of all the node types that are forum and then add
a count of all the comments ... That way you get an accurate count even if
the original post doesn't have any comments.

SELECT count(*)
FROM node n
LEFT JOIN comments c
ON n.nid=c.nid
WHERE n.type='forum'

On 4/12/07, Morten Holmstrup <morten at holmstrups.dk> wrote:
>
> Hi,
>
> I'm trying to put together a block that shows "forum statistics" like
> the ones that typically come with phpbb forums and so on. You know,
> things like "currently active users", "number of threads", "number of
> posts".
>
> Now, I think I have most of them down now - using a few snippets here
> and there - but I'm still missing a way to display the complete number
> of posts in the forums. The trouble is that replies are in reality
> comments, and how do you count the comments that are restricted to the
> forums? This is a small feature, I admit, but I'm weird that way ;)
>
> Please correct me, if I'm way off - this is my first site with Drupal
> (ammenet.dk).
>
> Anyone know, how to accomplish this or just point me in the right
> direction?
>
> (I tried the drupal.org forums, but haven't gotten any replies yet, so I
> thought I'd try here)
>
> thanks!
> Morten
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>



-- 

Kevin Bridges
http://www.kevinbridges.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20070412/b2adaeba/attachment.htm 


More information about the support mailing list