Get number of threads and posts for the whole forum.

edited November 2011 in Vanilla 2.0 - 2.8
Hey, just doing a little stats panel in my custom theme.

Just wondering how to get Number of threads and number of posts.

Thank you.

Answers

  • Would be a nifty thing to make into a module tucked inside a plugin to share.

    Simplest way would be to query the GDN_Discussion and GDN_Comment tables for the number of rows in them.
  • ToddTodd Vanilla Staff
    edited November 2011
    I'd query:
    select sum(CountDiscussions) as CountDiscussions, sum(CountComments) as CountComments
    from GDN_Category
    The category table is going to be smaller and faster. Actually, I think we have this in code too.
    $Root = CategoryModel::Categories(-1);
    $CountDiscussions = $Root['CountAllDiscussions'];
    $CountComments = $Root['CountAllComments'];
  • Cheers for your replies!

    Ill test them tommorow, its 6am, best get some sleep!
Sign In or Register to comment.