RTUR.NET

.NET and Open Source: better together

NAVIGATION - SEARCH

Commentor – new version

ctor-4 After using Commentor for almost three month now, I’m refreshing it with new version based on users feedback and my own experience. It saved me a lot of time so far catching almost 200 spam comments that I would have to remove manually otherwise. Even though I’m very satisfied with how it works, I hope new and improved version will be much better. Here is some of the key features that has been added or changed.

1. There is no more separate XML file to hold spam messages, Commentor will use BE moderation feature and act as automated moderator approving messages that passed validation. This allows to show/edit both approved and unapproved comments, so that you only need to look at one place. You can select between all/approved/unapproved to see only relevant comments.

2. I found that most of the time I can easily identify number of messages dropped by spam robot and “approve/delete all” option is not very useful, it has been replaced with “approve/delete selection” which is much more convenient in many cases.

3. Comment counters added to the row and to the footer.

ctor-2

4. Configuration moved to its own tab so that it does not get into the way every time you want just to look at latest comments.

5. Manual filter added to extension and now you can filter comments based on IP, name or content. If comment was blocked or approved by filter, Commentor will not make a call to the anti-spam service. You can use filter even without enabling such a service, although I would highly recommend to use one based on my experience with Waegis which is really great.

ctor-1

6. Edit comment pop-up dialog now let you approve/delete comment right from there saving time and clicks.

ctor-5

7. Spam counter control improved to work with both Waegis and Akismet, it’ll check which service you get enabled and show stats for this service only.

ctor-3

To install

1. Copy (FTP) files to your server
2. Enable comment moderation in admin/settings
3. Configure extension (admin->commentor edit->configuration)
4. Optionally, add spam counter control to your theme:

<%@ Register TagPrefix="cnt" TagName="SpamCounter" src="~/User controls/Commentor/SpamCounter.ascx" %> 
... 
<cnt:SpamCounter ID="spamCounter" runat="server" /> 

Upgrade from previous version

1. Approve/delete all comments in the Commentor
2. If you are using spam counter control, remove it from your theme. You'll need to remove these lines:

<%@ Register TagPrefix="pbw" TagName="PoweredByWaegis" src="~/User controls/Commentor/PoweredByWaegis.ascx" %> 
... 
<pbw:PoweredByWaegis ID="poweredByWaegis" runat="server" /> 

3. Delete ~/user controls/commentor folder, ~/app_code/commentor.cs and ~/app_data/datastore/extensions/commentor.xml 
4. Update spam counter; open /App_Code/Extensions/Commentor.cs and update it with your values (change nubmer from "0" to whatever your count is)

settings.AddValue("WaegisApproved", 0); 
settings.AddValue("WaegisRejected", 0); 

5. Restart IIS (log to the site and make sure Commentor gone)

Install new extension as described above.

Commentor.zip (30.961 kb)

Comments (29) -

Excellent, I'm sick and tired of Busby... I remembered this extension today, came to download it, and found this new version.

Thanks!

When i opened admin i got the following error

Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:


Line 37:
Line 38:         _settings = ExtensionManager.GetSettings("Commentor");
Line 39:         gridComments.PageSize = int.Parse(_settings.GetSingleValue("CommentsPerPage"));
Line 40:
Line 41:         if (!Page.IsPostBack)

Krishnan, looks like settings object was not reset/created properly. In happens in some environments based on setup of IIS and and other things that usually out of our hands. The easiest way to fix it to "jump-start" setting object. Copy "InitSettings()" function from commentor extension to the "admin.aspx.cs" and call it just before where it is failing like this:
if(_settings == null) InitSettings();

This will create default settings and error should go away.

Testing nested comment

This is excellent.  Thank you!  I've been using Chris' Comment Blacklist extension and it works great, but the updated Commentor is going to save me quality time managing my comments.  I really appreciate all of the great work you do with BlogEngine.NET.  

Sigh, yet again I have become obsolete...  seriously though, nice job!

I do agree with Juan, Fade up with Busby - Good to see this tool and hopes it really does take away the pain of manually doing it.Nice post.

Hey,

Thanks for the new version!
But I couldn't figure out how to block all comments without using Weiges or Askimet?

If I select "None", it approves automatically all comments. In previous version "None" blocked all comments, until I approve it manually.

You have to use "Moderate comments" option in general BE.net settings page, it will block all comments by default. Then you use any option in commentor that fit your needs, including manual moderation.

United States Kevin Cornwell

Nice work.

This mod needs to be integrated into the distro.


Excellent, Yeah getting SPAMMED with all the SEO Comment Spammers isn't fun. I will definitely give it a whirl. Hopefully this can be added in to the 1.5 release. :)

Just wanted to say - THANK YOU. The lack of comment management capabilities in Blogengine.Net has been frustrating me a lot, and it is in my opinion one of its biggest weaknesses. Not any more!

It really works and easy way to remove spam messages.thanks for sharing and keep updating.

Thanks you - anything that helps in managing comments has to be useful!  I'll certainly give it a go.  Thanks for sharing!

i have problem to reset statistic ,
...
settings.AddValue("WaegisApproved", 0);
settings.AddValue("WaegisRejected", 0);

not understand

Tnks

I I HAVE PROBLEM, WHEN I APPROVE COMMENT HAVE INCREMENT SPAM AND NOT APPROED COMMENT?

FOR EXAMPLE I APPROVED COMMENT, COUNTER OF SPAM ARE INCREMENT?WHY?THANKS

Nice work mate , really happy about the new release hope it gets more popular.

Many thanks for this really useful post.


Ah, now I know why comments were closed on the other post!  <grin>  

I'm a bit confused though...at the bottom of the configuration page, it says this:
Waegis: approved 12 blocked 21

Now...I've selected all of them and "Approved Selected".  They all still remain.  I'm assuming this is normal behavior, but am confused as to the 12 approved vs. 21 blocked...especially after I marked them all approved.  I do have 33 comments, so the math is right.  

Is there any way to know which ones Waegis thinks are blocked?  This is an awful lot of false positives so I'm a bit worried about how future comments will be handled.

Thanks for any insight, and thanks for a great extension!
AL

P.S.  This comment form is a bit jacked up on IE7.  Using FF3 to post...  Cheers!

Al, every time comment examined by Waegis counter at the bottom changes. If Waegis says it is spam than number of blocked incremented by one, otherwise approved goes up by one. Blocked comments have plus sign instead of a check mark in the list. If you look at example image on top of this page, first 3 comments are blocked and last 2 are approved.

Thanks for the reply!

I guess the confusion is that I have check marks all the way down, and zero plus signs.  Yet, I see the 12 vs 21 still at the bottom.

As well, Waegis has yet to update any statistics on API calls etc, and I've run comment tests and even had a Busby comment come in.  Still no updates.

Doesn't seem like things are right, but I've double-checked my URL and API Key...

Am I missing something?

Check on the settings page if you have manual filter turned on with 127.0.0.1 set to auto approve. If you do, remove this filter and see if it will help.

Yeah, just removed it.

I now have 35 comments, but the bottom still says 12 and 21 (adds up to only 33).  Still no change on Waegis website.

Is there any logging that can be set up for it?  Any other thoughts?  (thanks again for all the help!)

I have this exact problem.  I only have 2 comments but the bottom says  Waegis: approved 12 blocked 21.  

Haven't looked to see if this is hardcoded anywhere but that is my guess.

it's amazing what happens when you read all the instructions.  Jut change lines 453 and 454 under AppCode/Extentions/Commentor.cs to 0.  Problem solved, just like you said in the instructions above.  Only I'm sure thi is the only time I've installed this...

Hi Rtur,

I noticed today that when editing a comment, the changes aren't saved in the data store.  The culprit is the UpdateComment() method.

protected void UpdateComment(Comment comment)
{
    foreach (Post p in BlogEngine.Core.Post.Posts)
    {
        foreach (Comment c in p.Comments)
        {
            if (c.Id == comment.Id)
            {
                c.Content = comment.Content;
                break;
            }
        }
    }
    BindComments();
}

After c.Content is changed, no Save() method is called.  I put a p.Save() in there, but since the post wasn't marked as changed/dirty, it didn't do anything.  So I added a meaningless (temporary) update to the post's description so the post would get marked as changed.

Also, because I'm now modifying the Post in a foreach, I cast Post.Posts and p.Comments to an array to avoid errors with modifying a collection while enumerating it.

Mostly because of the meaningless update "hack", this is not the most elagant solution, but is working ...

protected void UpdateComment(Comment comment)
{
    // Cast ToArray so the original collection isn't modified.
    foreach (Post p in BlogEngine.Core.Post.Posts.ToArray())
    {
        // Cast ToArray so the original collection isn't modified.
        foreach (Comment c in p.Comments.ToArray())
        {
            if (c.Id == comment.Id)
            {  
                c.Content = comment.Content;

                // Need to mark post as "changed" for it to get saved into the data store.
                string desc = p.Description;
                p.Description = (desc ?? string.Empty) + " ";
                p.Description = desc;

                p.Save();
                break;
            }
        }
    }
    BindComments();
}

You right, once application restarted changes to comment body go away. I'll apply the fix later today, thanks for pointing this out.

hi Rtur,

Is this the fix you went with or did you change it another way?

Steven

Last refresh has this exact fix with few code cleanups. Hard-coded 12/21 Waegis counts also replaced with zeros.

Pingbacks and trackbacks (9)+

Comments are closed