Blog 4 Umbraco 2.0.10 – Comment moderation

Thursday, December 10, 2009 by Administrator

Today I continued the work on the comments part of the blog (after storing the comments in a seperate table and tackling comment spam with Akismet). I added a new control to the content dashboard where it will be possible to moderate the comments.

Dashboard ?

The (usually) blank right side of umbraco is called "The Dashboard". This area is configurable by adding references to the file called "/config/dashboard.config".

So I created a new usercontrol wich I added to the content dashboard by added this snippet to the config/dashboard.config

<section>
      <areas>
        <area>content</area>
      </areas>
      <tab caption="Comments">
        <control>/usercontrols/Blog4Umbraco/CommentModeration.ascx</control>
      </tab>
</section>

With this comment moderation usercontrol I simply list all the comments and make it possible to delete and mark as spam/ham , in case Akismet didn't make the right conclusion.

image

The content dasboard now has a comments tab where you can view all/only approved/only spam comments (with gravatar, author name, email, website, comment, timestamp and the page it was posted on). For each comment it is possible to delete. If the comment was seen as spam it has a different background color and it's possible to mark the comment as ham (this will send feedback back to Askimet and approve the comment so it displays on the frontend). If the comment wasn't seen as spam it's also possible to mark it as spam (wich will also send feedback back to Askimet and it will mark to comment as spam and remove it from the frontend).

The code for the usercontrol basicly just uses the datalayer to fetch all comments and then this is binded to a repeater.

private void BindData()
        {
            IRecordsReader rr = SqlHelper.ExecuteReader(
                string.Format(
                "select * from comment {0} order by created desc", Filter));

            rptComments.DataSource = rr;
            rptComments.DataBind();
        }

 

This is the first version of the comment moderation control, so there might be other features added in the next days.

8 comment(s) for “Blog 4 Umbraco 2.0.10 – Comment moderation”

  1. Gravatar ImageRoel Says:

    Nice one again Tim! Didn't look into the dashboard myself yet, but it's quite easy actually! These posts are great for reference as well.

  2. Gravatar ImagePetr Snobelt Says:

    Hi, where is implementation of defense against XSS attacks?

  3. Gravatar ImageJesper Ordrup Says:

    Nice Tim!

    How about adding and option on autoapprove future comments from same author.


  4. Gravatar ImageBrian Lorence Says:

    Just implemented this and I'm pleased with what you have done. My only request is that you implement the option to 'approve before posting'. Rather than the non-spam posts posting immediately, I would prefer to have the option to approve them - once approved, then they post. I may dig into your source code to implement this on my own if you dont plan to.

    Thanks again for the great work!

  5. Gravatar ImageBrian Lorence Says:

    Just implemented this and I'm pleased with what you have done. My only request is that you implement the option to 'approve before posting'. Rather than the non-spam posts posting immediately, I would prefer to have the option to approve them - once approved, then they post. I may dig into your source code to implement this on my own if you dont plan to.

    Thanks again for the great work!

  6. Gravatar Imagewinter boots Says:

    Keep up on good working!

  7. Gravatar ImageJonno Says:

    Just checking if this blog has moderation on the comments

  8. Gravatar ImageBhu Says:

    Just checking if this blog has moderation on the comments

Leave a comment