New and Improved Comment System for BlogEngine.NET
Update: When I switched hosting providers and upgraded BE.NET, I didn’t migrate the changes to the comment system to the newer version. This post describes my updates to version 1.x, but is no longer being used on my website.
BlogEngine.NET had a pretty decent commenting system, but it lacked some of the functionality I wanted in a comment system for my blog. So I decided to update it myself, which turned out to be a bigger deal than I thought it would be. Still, after a few evenings of work, I got my comment system. The following is a summary of the new additions.
Comment Listing By Type
The comments are now arranged in tabs, organized by type. Although the image above shows three types, there are actually four:
- Spam
- Unapproved Comments
- Trackbacks (and Pingbacks)
- Comments
The ‘Spam’ and ‘Unapproved Comments’ tabs are only visible to authenticated users. ‘Trackbacks’ and ‘Comments’ are only visible if there’s something there. The number in parentheses next to each tab contains the number of comments of that type in the tab. It is also possible to have a ‘Spam’ comment in the ‘Comments’ tab, if that ‘Spam’ comment has a reply which is not spam. In such cases, the ‘Spam’ comment will be collapsed and users will not be able to see the contents, but they will be able to see the reply. The inverse applies to the ‘Spam’ and ‘Unapproved Comments’ tabs.
Comment Rating System
Visitors to this blog can now rate the comments, in similar fashion to how users can digg items on Digg ( I even hijacked their thumbs up and down images, I hope they don’t sue! ).
Improved Comment Administration Interface
In the current version of BlogEngine.NET, there are basically two comment states: Approved and Spam. I added a third comment state: ‘Unapproved Comments’. These are comments that have not yet been either approved or marked as Spam. In the current implementation on this blog, no comments ever go to the Spam tab automatically – they have to be placed there by a moderator. However, if they fail a Spam check, they will be marked as ‘Unapproved Comments’ and not be visible to the public.
The Code
If you’re even thinking about putting this in your blog, you should read these release notes. I have uploaded a file that contains all changes to this location. However, keep in mind that these are NOT SIMPLE CHANGES. There was a lot of code modified, and you should be fairly familiar with ASP.NET before attempting to put these in your blog. You will need to recompile the BlogEngine.Core project to make this work. Also, if you are using anything other than the XmlProvider that comes with the blog as your data provider, you will need to update that for the comment rating and spam properties, as these are new. One other note about the zip containing the source: it assumes that you are also using the reCaptcha control I wrote not too long ago, although not all of the files necessary for the reCaptcha are in the zip.