Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

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

  • Options
    LincLinc Detroit Admin
    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.
  • Options
    ToddTodd Chief Product Officer 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'];
  • Options
    Cheers for your replies!

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