Discussion on Your WordPress Blog Using Comments

by April Hodge Silver Hasin Hayder | June 2009 | Content Management Open Source PHP

The primary focus of this article is to explain how to add comments and how to moderate these comments. In this article by Hasin Hayder and April Hodge Silver, we'll see how we can alter the comment and avtar settings and how we can avoid spam comments using Akismet plugin.

Comments are an important part of most of the blogs. While you are the only person who can write blog posts, the visitors to your blog can add comments to your posts. This can fuel a sense of community within a blog, allow people to give you feedback on your writing, and give your visitors a way to help or talk to other visitors. The only downside of commenting is that unscrupulous people will try to misuse your blog's ability to accept comments, and will try to post spam or advertisements in your blog instead of relevant comments. Luckily, the WordPress community is always developing more ways of fighting spam.

Adding a comment

If you look at the front page of your blog, you'll see that every post has a link that says No Comments » at the bottom. Clicking on that link will take you to the bottom of the post page, which is where comments can be added:

WordPress 2.7 Complete

If you're logged into the WP Admin, you'll see your name and a space where to write your comment. If you're not logged in, you'll see a comment form that any other visitor will see. This form includes fields to fill in for name, email, and website, along  with the commenting text area.

Once you type in the required information and click on the Submit Comment button, the comment will get entered into the WordPress database along with all of your other blog information. How soon it shows up on the site depends on your discussion settings.

Discussion settings

In the screenshot above, notice that Name and Mail are both marked as (required). As the owner of this blog, you can change the requirements for post comments. First, log in to the WP Admin and navigate to Settings | Discussion. The first box is the Default article settings in which we have options for allowing the comment box and trackback and pingbacks box. If you want either or both of these boxes to be unchecked by default, you can uncheck either or both of the boxes labeled Allow link notifications from other blogs (pingbacks and trackbacks) and Allow people to post comments on the article.

Submission, notification, and moderation settings

Let's take a look at the next three boxes:

WordPress 2.7 Complete

The boxes you check in these sections will determine how much moderation and checking a comment has to go through before it gets posted on the blog. In the screenshot we just saw, the settings shown are the default settings, which are pretty strict. The only way to make a more strictly controlled discussion on your blog is to check An administrator must always approve the comment. This option means that no matter what, all comments go into the moderation queue and do not show up on the site till you manually approve them.

Let's look at the settings having to do with submission. These two options, which are in the Other comment settings box, control what the user has to do before he or she is even able to type in a comment:

  • Comment author must fill out name and e-mail

    As you noticed in the screenshot in the Adding a comment section, Name and Mail are marked (required). If you leave this checked, then anyone posting a comment will encounter an error if they try to leave either of the fields blank. This doesn't add a huge amount of security because robots know how to fill out a name and an email, and because anyone can put fake information in there. However, it does help your blog readers to keep a track of who is who if a long discussion develops, and it can slightly discourage the utterly impulsive commenting.

  • Users must be registered and logged in to comment

    Most bloggers do not check this box because it means that only visitors who register for the blog can comment. Most bloggers don't want random people registering, and most visitors don't want to be compelled to register for your blog. If you check this box, there's a good chance you'll get no comments (which may be what you want). Or, if you're setting up a blog for a closed community of people, this setting might be useful.

Now let's look at the settings that have to do with moderation. These two options, which have to do with the circumstances that allow comments to appear on the site, are in the Before a comment appears box:

  • An administrator must always approve the comment

    As I mentioned before, if this box is checked, every comment has to be manually approved by you before it appears on the site.

  • Comment author must have a previously approved comment

    If you uncheck the box above this, but check this one, then you've relaxed your settings a little bit. This means that if the person commenting has commented before and had his or her comment approved, then the person's future comments don't have to be verified by you; they'll just appear on the website immediately. The person just has to enter the same name and email as the previously approved comment.

Now let's look at the settings that have to do with notification. These two options are in the Email me whenever box. These options are related to the circumstances of receiving an email notification about the comment activity.

  • Anyone posts a comment

    This is generally a good setting to keep. You'll get an email whenever anyone posts a comment—whether or not it needs to be moderated. This will make it easier for you to follow the discussion on your blog, and to be quickly aware of a comment that is not moderated and requires deletion.

  • A comment is held for moderation

    If you're not particularly interested in following every comment on your blog, you can uncheck the Anyone posts a comment checkbox and only leave this one checked. You won't get an email about legitimate-looking comments that don't appear to need moderation, but only those that need your approval.

The remaining settings, which are all in the Other comment settings box, have to do with comment display and are pretty self-explanatory. You won't be able to see many of these settings in action until you have lots of comments.

When to moderate or blacklist a comment

If you scroll down the page a bit, you'll see the Comment Moderation box:

WordPress 2.7 Complete

This is an extension of the moderation settings from the top of the page. Note that if you've checked the An administrator must approve the comment checkbox, you can safely ignore this Comment Moderation box. Otherwise, you can use this box to help WordPress figure out which comments are probably OK and which might be spam or inappropriate for your blog. You can tell WordPress to suspect a comment if it has more than a certain number of links, as spam comments often are just a list of URLs.

The larger box is for you to enter suspect words and IP addresses:

  • Here you can type words that are commonly found in spam (you can figure this out by looking in your junk mail in your email!), or just uncouth words in general.
  • The IP addresses you will enter into this box would be those of any comments you've gotten in the past from someone who comments inappropriately or adds actual spam. Whenever WordPress receives a comment on your blog, it captures the IP address for you so that you'll have them handy.

Scroll down a bit more and you'll see the Comment Blacklist box:

WordPress 2.7 Complete

Unlike the Comment Moderation box we just saw, which tells WordPress how to identify the comments to suspect, the Comment Blacklist box tells WordPress how to identify comments that are almost definitely bad. These comments won't be added to the moderation queue and you won't get an email about them; they'll be marked right away as spam.

Avatar display settings

The final box on this page is the Avatars box:

WordPress 2.7 Complete

An avatar is an image that is a person's personal icon. Visitors who are very active on the Internet and comment frequently may have set up an avatar that they like to use. If so, it will show up on your blog if you leave the Show Avatars radio button checked.

The second box, Maximum Rating, will tell WordPress if it should not show avatars that have been rated too highly.

The third box, Default Avatar, tells WordPress what avatar to use for visitors who do not come with their own avatar. When you installed WordPress, it created a comment for you on the first post, and also created a default avatar for you. You can see the default avatar, Mystery Man, at use on the Hello World! post:

WordPress 2.7 Complete

Moderating comments

Now that we've thoroughly explored the settings for which comments need to be moderated, let's discuss what you actually need to do to moderate comments. Moderating means that you look over a comment that is in limbo and decide whether it's good or bad. If it's good, it gets to appear on the website; and if it is bad, it's either marked as spam or is deleted and is never seen by anyone but you and the poster who wrote it.

To view comments waiting for moderation, log in to your WP Admin and navigate to Comments in the main menu.

WordPress 2.7 Complete

If you have any comments waiting for moderation, there will be a little orange number in the main menu telling you how many comments await moderation.

WordPress 2.7 Complete

This Edit Comments page is fully featured, just like the Edit Posts page. For each comment, you see the following information from left to right:

  • Comment text, along with links to Approve it so that it shows up on the site, mark it as Spam, Delete it, Edit it, Quick Edit it, or Reply to it
  • Commenter name, avatar, email address, and IP
  • Comment submission time and date
  • The title of the post on which the comment was made (which is also a link to edit that post), a number in parentheses indicating how many approved comments are already there on that post (which is also a link that will filter the comments list so that it shows only comments on this page), and a link to the post itself (indicated with a hash #)

Comments that are awaiting moderation have a yellow background.

You can click on the Quick Edit link for any post to open form fields right within this list. This will allow you to edit the text of the post and the commenter's name, email, and URL.

You can use the links at the top—All, Pending, Approved, and Spam—to filter the list based on those statuses. You can also filter either only pings or comments with the Show all comment types pull-down filter menu. You can check one or more comments to apply any of the bulk actions available in the Bulk Actions menus at the top and bottom of the list.

Another quick way to get to this page, or to apply an action to a comment, is to use the links in the email WordPress sends you when a comment is held for moderation.

How to eliminate comment spam

Comment spam are comments that get posted on your blog that have spam content, just like spam email. If you've set up your moderation settings to be relatively secure, then these comments won't appear on your blog. However, you may get dozens of email a day from WordPress asking you to moderate comments that it knows need moderation, but doesn't know are spam.

The best tool available for eliminating comment spam from your blog is the Akismet plugin. This plugin, which comes (though inactive) with your WordPress installation, utilizes the Akismet spam-fighting service. Now, we'll review how to get Akismet working on your blog. If your blog is built on WordPress.com, then Akismet is already activated by default on your blog.

Learning more
You can learn more about the Akismet spam-fighting service from http://akismet.com/.

Getting a WordPress.com API key

The Akismet plugin requires that you have a WordPress.com API key. To get one, you have to create an account at WordPress.com, even if you don't have a blog there. Once your account is active, log in to WordPress.com and use the menu at the very top to go to your profile:

WordPress 2.7 Complete

When you are on the Your Profile page, you'll see your WordPress.com API key right at the top:

Select and copy that text. You may want to paste it into a text file to be sure you have it.

Activating Akismet 

Now go back to your WordPress installation and navigate to Plugins in the main menu:

WordPress 2.7 Complete

You'll see Akismet listed as the first plugin. Click on the Activate link. A yellow message bar will appear at the top of the page that says Akismet is almost ready. You must enter your WordPress.com API key for it to work. Click on that link and you'll be taken to a page where you can enter your API key you have copied from WordPress.com:

WordPress 2.7 Complete

Paste your API key into the box. I suggest you also check the box below it about automatically discarding spam comments. Akismet is very good at identifying which comments are actually spam, and checking this box will make them disappear. However, if you're concerned about Akismet misidentifying comments, leave this unchecked.

Now click on Update options>> and your blog is protected from comment spam!

Summary

In this article we saw how to change the default settings for comments and how to avoid spam comments using Akismet plugin that comes pre-installed with WordPress.

About the Author :


April Hodge Silver

April has been designing and developing new web sites from scratch since 1999, just before her graduation from Columbia University. Early in her career, she worked for several web companies and startups, including DoubleClick and About.com. Since 2004, she has been self-employed through her company Springthistle Design and has worked with a staggering variety of companies, non-profits, and individuals to realize their web site dreams. In her professional work, April's focus is always on usability, efficiency, flexibility, clean design, and client happiness. WordPress is the best solution for many of Springthistle's Clients, though April also develops custom web applications using PHP and MySQL. More about April's professional work at http://springthistle.com

In her free time, April enjoys developing recipes in the kitchen, bicycling, and relaxing with her daughter, dog, and darlin wife.

Hasin Hayder

Hasin Hayder graduated in Civil Engineering from the Rajshahi University of Engineering and Technology (RUET) in Bangladesh. He is a Zend-certified Engineer and expert in developing localized applications. He is currently working as a Technical Director in Trippert Labs and managing the local branch in Bangladesh. Beside his full time job, Hasin writes his blog at http://hasin.wordpress.com, writes article in different websites and maintains his open source framework Orchid at http://orchid.phpxperts.net. Hasin lives in Bangladesh with his wife Ayesha and his son, Afif.

Books From Packt


WordPress 2.7 Cookbook
WordPress 2.7 Cookbook

Choosing an Open Source CMS: Beginner's Guide
Choosing an Open Source CMS: Beginner's Guide

WordPress Theme Design
WordPress Theme Design

Plone 3 Theming
Plone 3 Theming

Drupal 5 Views Recipes
Drupal 5 Views Recipes

WordPress Plugin Development: Beginner's Guide
WordPress Plugin Development: Beginner's Guide

Blogger: Beyond the Basics
Blogger: Beyond the Basics

WordPress for Business Bloggers
WordPress for Business Bloggers

 


No votes yet
Thanks by
I really appreciate with the above information. Thanks for this interesting information.
Great job by
Cool and awesome. So glad I reach your page and is able to read so learning experience article.
very nice artical by
I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post.
Great topic :) by
Rather interesting blog you've got here. Thanks for it. I like such themes and everything that is connected to this matter. I definitely want to read a bit more on that blog soon.
Great info by
Nice text. Keep posting that way.
Great details by
Nice article. Keep posting that way. Joan Benedict
Great details by
Impressive content. When will I get the more details? Hilary Swenson
Nice details by
Cool post.

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
U
n
F
C
k
M
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software