My good friend Antonio suggested that I write a quick blog about this and on consideration, I wonder why I had not previously done so... thanks for the suggestion, Antonio.
If you have your blogs set to require approval for comments, it can be fairly easy to miss some. Sure, the blog module will send you a reminder (if you have your email address set), but emails can be lost too.
To help our team out in this area, I'd put together a couple of quick tools using the Reports module. The point of the reports is simply to help team members identify "dangling" comments that should be handled.
This first report is a personal one. That is that it uses the Reports module to fetch a personal report for the logged in user providing direct links to their blogs and identifying entries that have unapproved comments. It looks like this:
And the SQL to generate that using the reports module is simple. The only things you should changes are the TABID for your blog page and (if desired) the length of time for which the report is applicable. In this example, the report will fetch blogs that are less than 3 months old.
select '<a href="/tabid/825/EntryID/' + convert(nvarchar(10),be.entryid) + '/default.aspx">' + be.title + '</a>' as 'Blog'
, count(bc.entryid) as 'Comments', (select count(*) from blog_comments where entryid = be.entryid and approved=0) as 'Unapproved'
from blog_blogs b, blog_entries be, blog_comments bc
where b.userid = @UserId
and b.blogid = be.blogid
and b.[public]=1
and be.entryid = bc.entryid
and be.addeddate > dateadd(mm,-3,getdate())
group by be.entryid, be.title
The second report is like the first, but one I use to see how the whole team is doing... it provides a similar report for all blogs for all users for all time. A snip of that report looks like this:
The SQL for that report is similar, although there are some tings in it that are personalized for us, such as limiting the search to current blogging roles.
select u.firstname, ' you have ', count(distinct bc.commentid), ' comments that require attention on:',
'<a href="/tabid/825/EntryID/' + convert(nvarchar(10),be.entryid) + '/default.aspx">' + be.title + '</a>'
from users u, userroles ur, blog_blogs b, blog_entries be, blog_comments bc
where u.userid = ur.userid
and ur.userid = b.userid
and b.blogid = be.blogid
and b.[public]=1
and be.entryid = bc.entryid
and bc.approved = 0
and ur.roleid in (22,199)
group by u.firstname, be.entryid, be.title
order by u.firstname
Anyway, hope this is helpful to someone. The Reports module can be a very handy way to help your users keep up with things. If there are suggestions for improvement or other creative uses that you have identified, I hope folks will share!
Cheers