To Be or To Do Be Do Be Do and Spam Control

There’s nothing like a search for meaning to plump up one’s to-do list. I committed to making 100 posts in 100 days, as I feel out the values behind how I want to brand this site. Four posts in and my to-do list is about a mile long. The basic run down on where the initial list-o-stuff is coming from looks like this:

  • Personalization
  • Productivity
  • Pick some stuff I like

But, you see, everything has lots and lots of homework, housekeeping and backstory. Intelligible backstory may end up being a challenge, or at least that’s what it looks like now. How can I write 100 posts even loosely centered around the meaning of meaning without slipping into self indulgent chaos?

Failure often stems from lack of a coherent game plan, inviting the wrong team members onto the bus, & not facing brutal truths. Tactic or trap, writing from the self-center person can be an intentional grammatical style book decision.

Arrogance & Writing in Self-Center Person

So be it. LOL. Right now, here I am at intentional style book decision, and this is what there is, and for now I’m tunneling into homework and housekeeping, one chunk at a time. At the very least, I will have learned a few things about what it is like to write on a schedule.

Yesterday I blogged about plugins that add author Gravatars and MyBlogLog avatars to comments. Looking into them got to be a higher priority when I was writing out my thoughts about what my personal brand may be. You see, I look at links and think of the people behind them or in front of them. Putting a face on comments is a natural extension of who I am as a brand. Besides, I like seeing them.

Doing that didn’t seem right without also talking about today’s subject – spam. To communicate through them ya gotta enable them, use them, and trust them. As soon as there is a way in there will be spam.

Spam Moderation

This is how I deal with comments, from the admin setup side of WordPress.

Users must be registered and logged in to comment is left unchecked at Options > General. Because I want interaction to be easily available I do not require registration.

Everything else non-plugin happens at Options > Discussion, where I have all boxes checked.

The first three are communication related. I ping others (Attempt to notify any blogs linked to from the article,) allow others to ping me (Allow link notifications from other blogs,) and allow people to post comments.

The rest have to do with how much moderation I want, and how much communication I’d like about moderation. For the most part, I like to be e-mailed whenever anyone posts a comment, or a comment is held in moderation. I’m not a fan of having yet more emails stacking up in my inbox, but this is a worthy cause.

To keep a leash on what gets out there, before a comment appears an administrator must always approve the comment, and the comment author must fill out name and e-mail.

I also use Simple Trackback Validation to control trackback spam. Here are the basics on Simple Trackback Validation and two other anti spam plugins that most practiced bloggers will be familiar with.

Plugins that Filter Out the Un-person


Simple Trackback Validation

Does just what it says. I use it here. I have it set up so that all trackbacks go into a moderation que: something I find comforting.
By Michael Woehrer.
Configuration available at Options > Simple TB Validation

Eliminates spam trackbacks by (1) checking if the IP address of the trackback sender is equal to the IP address of the webserver the trackback URL is referring to and (2) by retrieving the web page located at the URL used in the trackback and checking if the page contains a link to your blog.

Akismet

The gold standard. Remember to check the spam bin for false positives.
By Matt Mullenweg.
Configuration and API key entry at Plugins > Akismet Configuration

Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a WordPress.com API key to use it. You can review the spam it catches under “Comments.” See also: WP Stats plugin.

Math Comment Spam Protection

Some people like to add Math to Akismet. Using Math will cut down on the number of spam that get to Akismet’s spam bin, making it much easier to sift out false positives.

By Michael Woehrer.
Configuration at Options > Math Comment Spam

Asks the visitor making the comment to answer a simple math question. This is intended to prove that the visitor is a human being and not a spam robot. Example of such question: What is the sum of 2 and 9?

Comment Avatar Plugins

As promised yesterday, here are some brief reviews for plugins that will add author Gravatars or avatars to comments. A Gravatar is a globally recognized avatar. To get a Gravatar, users must register with Gravatar. MyBlogLog users can upload an avatar when registering their blog with MyBlogLog.

Some Gravatar and Avatar Resources

Keeping the Conversation Going

How many times have you left a comment on a blog and forgotten the exact URL or wondered what others might have to say next? Subscribe to Comments takes care of that. This is one of my favorite plugins.

Subscribe To Comments

Inserts a checkbox under the comment form where users can choose to receive an automatically produced email alert whenever someone else posts a comment to that specific post. Users can manage their own subscription.
Based on version 1 from Scriptygoddess By Mark Jaquith.
Configure at Options > Subscribe to Comments

Allows readers to receive notifications of new comments that are posted to an entry.

Plugins for Comments – Gravatars and Avatars

Gravatar

In version 1.1 the link to the plugin page (above) is broken. This is the correct link. This plugin requires simple editing of the comments.php file. Users who are not as familiar with editing a template file may appreciate a reminder to enclose the suggested code in an image tag, like so:

<img src="<?php gravatar("PG", 40); ?>" alt="" />

Users who are comfortable with PHP will find ways to customize this plugin, but it is not as well documented as Filosofo’s WordPress Gravatar Plugin.
By Tom Werner.
No configuration option from the dashboard

This plugin allows you to generate a Gravatar URL complete with rating, size, default, and border options. See the documentation for syntax and usage.

Filosofo’s WordPress Gravatar Plugin

Requires simple editing of the comments.php file. Filosofo.com’s usual straightforward documentation includes a way to specify a CSS class and a default image for those who are not registered with gravatar.com.
By Austin Matzko.
No configuration option from the dashboard.

Add Gravatars to your WordPress theme in a way that customizes easily and degrades nicely.

Easy Gravatars

Though Easy Gravatars uses only Gravatars and doesn’t have the configuration options of other Gravatar plugins, it has enthusiastic supporters because of its simplicity. CSS, maximum size and rating are configurable, and a blank, one pixel gif is inserted when no Gravatar is available. No need to edit the template – just install the plugin and Gravatars will appear.
By Dougal Campbell.
Configure at Options > Easy Gravatars

Add Gravatars to your comments, without requiring any modifications to your theme files. Just activate, and you’re done!

MyAvatars

MyAvatars is my favorite. It works, and you get both MyBlogLog avatars and Gravatars, because MyBlogLog avatars are used unless Gravatars are found. Requires simple editing of comments.php. Fine tune by adding desired formatting to the comment section of your style sheet and you’re good to go. In my case I used this:

 img.MyAvatars {float: left; margin: 0 5px 5px 0;}

By Andrea Micheloni & Napolux.
No configuration available from the WordPress dashboard.

This plugin allows you to add MyBlogLog.com avatars to WordPress comments.

WordPress Gravatars

No editing of the theme is needed. Has a nice configuration page, and can add a Gravatar or use a favicon. If this one also supported MyBlogLog avatars I’d be using it, because it has nice integration with other widgets for Author Profile and Recent Comments. It can even insert a Gravatar at the top left of post content, where you’d want an author image.
By Rune Gulbrandsøy.
Configuration available at Presentation > Gravatar

Makes use of Gravatars, places Gravatars in the comments section. Uses the comment authors email to display their Gravatar. It also gives the user an Author Profile picture, based on his or hers Gravatar. Change your options here. As of version 2.2 there is also a widget for Recent Comments with Gravatars.

WordPress Post Category Icons

When I started my blog last month I had planned to fairly quickly add three custom graphic elements. Category avatars were at the top of my list.

Category avatars are a nice way to automatically add visual interest to a blog that is mostly text. Author avatars help, but are not practical for a single-author blog where you’d see the same image over and over again.

These are from the graphics part last month’s wish list:

  • A nice feed icon
  • An avatar for each WordPress category
  • Think about holiday graphics

Looking back over my list, it occurred to me that I could do a quick temporary fix for all three with one operation. I can add code that associates an image with each category, and use holiday themed RSS feed icons for my images. The code part will be finished, and in a week or two I can make images to use long-term. All I need are some holiday themed feed icons that are large enough to work in an avatar-like space.

In my wanderings I found 12 free Christmas RSS feed icons that go with the dark red that I like. At about 100px square they’re the perfect size.

Adding the Category Icons

Because the_category_ID is depreciated, I don’t want to follow the same plan as in my post about adding WordPress post author avatars, where I used the author ID to select an image name.

According to WordPress, the_category_ID was replaced when posts gained the capacity for multiple categories.

Their example of how to replace the_category_ID will return the ID number of whichever category applies to the post you are viewing. If the post is in two categories, two ID numbers will be returned.

 
<?php
foreach((get_the_category()) as $category) {

    echo $category->cat_ID . ' ';
} ?>
 

Getting a list of categories associated with a post is not hard. What I wanted was one image associated with the specific category of the post. With the help of the WordPress Codex, these are the two solutions I came up with.

Category Images Using get_the_category

This one uses get_the_category and cat_name to show one image for posts that are associated with more than one category.

 
<?php $cat = get_the_category(); $cat = $cat[0];
 { echo '<img src="http://domain.com/wp-content/cat-img/' . $cat->cat_ID . '.png"
alt="' . $cat->cat_name . '" />'; } ?>

 

How does WordPress decide which category to use for the image, when there is more than one category associated with a post? In this case, the choice depends on what category name comes first in the alphabet. Check the list of category names in your WordPress post edit window and you’ll see that they are in alphabetical order, too.

This can be a little confusing, because permalinks don’t use the same method to name the directory associated with a category. When faced with a choice of more than one category, permalinks use the slug of the category with the lowest cat_ID number.

I want the image to match the directory.

Category Images Using elseif and in_category

Using in_category() and specifying which category goes with which image will give more control. Here I am manually choosing which image to display for the first two categories. In all other cases the image “3.png” will be used.

WordPress uses the category ID with the lowest number for both the category’s permalink directory and the image selected to associate with the post.

 

<?php if ( in_category(1) ) {
echo '<img src="http://domain.com/wp-content/cat-img/1.png" />';

} elseif ( in_category(2) ) {
echo '<img src="http://domain.com/wp-content/cat-img/2.png" />';

} else {
echo '<img src="http://domain.com/wp-content/cat-img/3.png" />';
}
?>
 

There may be a more elegant way. I am at the beginning of my journey into php. If anyone would like to offer feedback, please comment. Note — actual php is not allowed by the comment form.

Next Steps

Because a feed icon feels like it should be a clickable path to a feed, the images should be linked to my RSS feed. I chose to wrap each image tag in a link to http://ablereach.com/feed/ instead of an individual category feed, because there may be significant gaps between posts in any given category: this is a single person blog.

Next, I edited my style sheet to add some styling to float my images to the left, add a little space around them and eliminates any border.

 
.icons {display:inline;
        float: left;
        border: none;
        margin: 5px 10px 5px 0px;}

 

Then, all that remained was to add an alt to the images, a title to the anchors and paste the finished code into my theme. Happy, festive and finished.

Soooo, would anyone like to lay bets on my chances of finishing new category avatars before the jolly holly theme is hopelessly out of date?
;-)

One step at a time!

Adding Post Author Avatars

One of the neat things about WordPress is that a non-programmer can add personalized tweaks fairly easily, with a basic understanding of nesting. The trick is to find what something is called and simplify goals. Simplification is often a matter of not requiring special treatment for specific situations, unless that is something you already know how to do. Of course, once you know a thing it becomes infinitely simpler to accomplish.

In this case, I wanted avatar images to appear automatically at the top left of a multi-authored Kubrick-based theme. I wanted the “Pages” content to be associated with the site as a whole, not with any individual writer. Guest blog authors have their own WordPress user accounts. Some posts are attributed to site staff and can be represented by a logo. Already, that gives me a few places to start.

WHAT: an image

<img src="filename.jpg" />

When doodling about how to accomplish something, I like to start on familiar territory, as simply as possible.

To make it easier to keep track of my images, I created a folder called avatars, and placed it in the wp-content folder. Using <?php echo get_option('home');?> to define the root domain of the blog makes this bit of code reusable, should I want to use it for another site. The result is an as-yet undefined file name with a URL that looks like this:

<?php echo get_option('home');?>
/wp-content/avatars/filename.jpg

WHO: post authors

Next I decided how to tell WordPress to display a specific image for each author. Because all authors have a user ID, which image to display can be taken care of by associating the image with the user ID of the current post’s author. I looked in the file “/wp-includes/author-template.php” to see how WordPress defines things author. This is also how I found the code I used to define my alt descriptions.

The result is a file name that looks like this:

<?php the_author_ID(); ?>.jpg

For this to work, the avatars folder I made in the last step needs to contain an image for each author ID that is named to correspond to that ID. The file name “1.jpg” would be inserted by WordPress when the person with ID number “1” is the author. You can find author ID numbers listed by user names, under the Users tab.

ALT: describe the image

Following the same logic, I chose to use the following to automatically create my alt descriptions:

<?php the_author(display_name); ?>

Easy peasy.

HOW: control image styling

Elizabeth AbleAdd a class to your stylesheet that will control and enhance image styling.

I like to float author avatars to the left and give them a little padding and a border. Below is the css I used for the image at left.

 
.avatar {display: inline;
         float: left;
         padding: 4px;
         border: 4px solid #efefe7;
         margin: 5px 10px 7px 0px;}

 

WHERE: choose placement in template files

The following will work in Kubrick-based themes, as well as many others. Your own theme may have design elements that require a little tinkering, or even have different template files.

To place an author avatar only in blog posts, add the code below into index.php. Do the same in page.php if you also want avatars on static Pages.

Add these lines just before <?php the_content.

<img src="<?php echo get_option('home'); ?>
/wp-content/avatars/<?php the_author_ID(); ?>.jpg"

class="avatar" alt="<?php the_author(display_name); ?>" />

And that’s it.

Hat tip to CodeHighlighter plugin by Wongoo Lee.

Plugging Plugins

I am a plugin junkie. Here are a few that I like to install right after setting up WordPress.

Akismet

The quinessential WordPress comment spam stopper, Akismet is part of a WP base install. In addition to installing Akismet, go to Options > Discussion and decide how much control you want over comments.
By Matt Mullenweg.
Go to Plugins > Akismet Configuration to enter your free WordPress.com API Key.

Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a WordPress.com API key to use it. You can review the spam it catches under “Comments.” To show off your Akismet stats just put in your template.

Google XML Sitemaps

Never say never to Google. Make sure to enable Update Notification, especially “Modify or create robots.txt file in blog root which contains the sitemap location.”
Configuration Page By Arne Brachhold.
Configuration is at Options > XML Sitemap

This plugin will generate a sitemaps.org compatible sitemap of your WordPress blog which is supported by Ask.com, Google, MSN Search and YAHOO.

Subscribe To Comments

Very handy! I seldom appreciate signing myself up for a mailing list as much as I appreciate getting notice of an ongoing conversation in a blog. Blog comments have become an important part of online community-building. Subscribers can manage their own subscriptions. If you use this, be sure to add a line to your privacy policy or comment policy about how you use any collected email addresses.
By Mark Jaquith.
Configure at Options > Subscribe to Comments
Manage subscriptions at Manage > Subscriptions

Allows readers to receive notifications of new comments that are posted to an entry. Based on version 1 from Scriptygoddess.

Top Level Categories

I use this because I like stripping off layers, and WordPress likes to make available lots of lists or how posts might be grouped. If I wanted a table of contents for categories, I’d put it in sidebar navigation or a sitemap.

By Filipe Fortes.
No configuration needed, simply activate.

Removes the prefix from the URL for a category. For instance, if your old category link was /category/catname it will now be /catname.

Ultimate Google Analytics

Sure, you can just paste your tracking code to the footer.php file. Why not let Google Analytics do a little more?
By Wilfred van der Deijl.
Configure at Options > Ultimate GA.

Enable Google Analytics on your blog. Has options to also track external links, mailto links and links to downloads on your own site. Check http://www.oratransplant.nl/uga/#versions for version updates.

WordPress Database Backup

You need this, because accidents and disasters happen and it’s not nice to be without a backup. Database backups can be created on demand or automatically.
By Austin Matzko.
Configure at Manage > Backup

On-demand backup of your WordPress database. Navigate to Manage → Backup to get started.

All in One SEO Pack

Do you need it? Maybe, maybe not. Do you want to play with it? Come on, of course you do.
Let the plugin fill in the blanks for you, or choose specific titles, keywords and descriptions for each page and post, or do a little of each.

By uberdose.
Configure at Options > All in One SEO.

Out-of-the-box SEO for your WordPress blog.

cforms II

Cforms is fun to use. Use it to create multiple forms with distinct purposes. Includes help files, examples, and way more configuration alternatives than you’ll probably need for any one form.
By Oliver Seidel.
Configuration and more at the CformsII tab.

cforms II offers unparalleled flexibility in deploying contact forms across your blog. Features include: comprehensive SPAM protection, Ajax support, Backup & Restore, Multi-Recipients, Role Manager support, Database tracking and many more.

A New Look

I finally got my site out of tables and into WordPress.

I started with Bruce Gardner’s Blue Zinfandel Squared Enhanced theme, because I am learning WordPress and I like his detailed approach to CSS. I’ve found that working with other people’s code is a good way to learn, and both Blue Zinfandel Enhanced and Blue Zinfandel Enhanced have a layout structure I like, plus lots of thoughtful details to play with.

Sometimes, half way into the process, I’ll decide that the original theme author’s sense of organization is hard to work with. That’s when the real restructuring starts. In this case, under the skin, much of what I left is almost exactly like the original author’s. My biggest structural change was to swap out the #wrap div to help me make the header area go full width, while the rest of the page stays at a fixed width. Just for fun, to the center area and the footer I used a border radius that will make rounded corners in FireFox. In case you’re interested, here’s an example of the radius CSS:

#wrap {border-radius: 10px; -moz-border-radius: 10px;}

And that’s all she wrote. Fun stuff, huh? One line of code, no cutting up little circles of the inner and outer color, and presto zappo you get curvies.

These curves won’t show in some browsers, and without curves the design looks a little too plain for my taste. Adding a 1px light gray border helps to add a little definition. I may add a background gradient or an image for shading, but what’s there seems fine to me for now.

Other changes so far have been to add a background color, some image-based bullets, and switch some fonts. In the future I will be experimenting with blockquotes, the date image, and doing more with the comment box styling, and I want to adjust spacing around some of the text elements. In the meantime, what I have already is fine.

Presto zappo and “Hello World,” we got theme.

Hat tip – if you haven’t seen Bruce Gardner’s Revolution Theme, check it out. Smooth!