Howto get MyAvatars to work with Brian’s Threaded Comments

Last week I installed a bunch of plugins on this blog but unfortunately I couldn’t get the MyAvatars plugin to work. This is a WordPress plugin which shows cute little avatars next to your comments if you’re a MyBlogLog member.

 This plugin requires a few code changes in the comments.php file from your theme but the installation manual wasn’t really helpful because I had already installed a plugin called Brian’s Threaded Comments which required me to replace the default comments.php file.

Today I had a bit more time to mess with the code so I decided to figure out how I could get MyAvatars to work with Brian’s Threaded Comments.

Here’s what you need to do:

1. Make sure Brian’s Threaded Comments is properly installed.
2. Download the MyAvatars plugin, upload the files and activate the plugin in your plugin page.
3. Now you need to integrate the MyAvatars plugin in your theme. Open your FTP client and go the folder of your WordPress theme and open comments.php.

Now insert this code:

<? if(function_exists("MyAvatars")) MyAvatars(); ?>

Between these two lines:

<div class='content'>

<?php comment_text() ?><?php

That’s all you need to do. Now you should see those MyBlogLog avatars next to comments on your WordPress blog. Depending on the theme you’re using it may also be necessary to edit the style.css file in the MyAvatars folder to improve the visual appearance.

Small hack for MyAvatars
After I installed the MyAvatars plugin I noticed one small flaw: when a user posts a comment and leaves the URL field empty the plugin will show the alt image text instead of the anonymous person icon from MyBlogLog.

So I decided to mess a bit with the code from the myavatars.php file so it will show the icon from MyBlogLog when a user doesn’t enter a URL:

1. Open myavatars.php
2. Search for:

$nickname = $comment->comment_author;

3. Insert the following code:

if (empty($url)) {$url = "http://www.";}

It’s not really elegant but it works

One response to “Howto get MyAvatars to work with Brian’s Threaded Comments”

Leave a Reply