Archive for the 'Development' Category

Button-mashing detected: a duplicate comment filter

Monday, November 5th, 2007

Here’s a feature every website with comments should have: automatic detection of duplicate comments. We’ve all done it; the page is taking a little too long to load, so we start hammering on the “Submit” button over and over again until it finally goes through and we’re horrified to see we’ve managed to post our comment twice.

I was reading one of my favorite websites today - TheSimpleDollar.com - and ran into that situation. Luckily WordPress has this functionality built-in, and sends you to a page that tells you “Duplicate comment detected, it looks like you already said that!”

I’ll try and remember to include this type of feature into any future projects I develop. The code should be relatively easy; just a database call to the last comment made by that user to see if they match.