Counting non-hidden comments
I am trying to write a plugin to hide/unhide comments and discussions. I created a custom flag in comments and discussions tables that can take three values (0 - hidden, 1 - visible and 2 - visible to author only).
Taking this into account, what would be the right way to get comment totals? I see in the templates it is taken directly from the database (echo $Discussion->CountComments;). Should I create a function and use it in every place $Discussion->CountComments is mentioned?