Rob's Blog

Postings from the world of Rob Ferrer
  • rss
  • Home

Freshy 2 & Gravatar Bugfix

June 16, 2008 | 10:52 am

Please Note: [update 2008-08-20]: This has now been fixed as of Freshy 2.0.8, so you shouldn’t need to make any changes other than updating to the latest version. I am leaving this post for the sake of archive.

Any regular readers (although I don’t think I actually have any!) of this blog will notice I recently changed the theme to the fantastic Freshy 2 theme from Jide.fr. Together with the customise plugin it’s a great theme with many great features, including support for the Gravatar plugin.

Unfortunately as of version 2.0.6 there’s a very small error in the way the Gravatar function is implemented, which means the Gravatars aren’t displayed properly (and in fact it means commenter’s email addresses are displayed in the source).

Luckily the fix is very simple. You need to edit the file comments.php (using the theme editor or your favourite method), and find the following section (around line 37)(sorry about the indentation – WordPress insists on removing it!):

<?php // gravatars
if (function_exists('gravatar')) {
if ('' == $comment->comment_type) {
echo '<img class="avatar" src="';
gravatar($comment->comment_author_email);
echo '" alt="'.$comment->comment_author.'" width="40" height="40" />';
} elseif ( ('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type) ) {
echo '<img class="avatar" src="';
gravatar($comment->comment_author_url);
echo '" alt="'.$comment->comment_author.'" width="40" height="40" />';
}
} else {
//echo '<img class="avatar" src="'.get_bloginfo('stylesheet_directory').'/images/default_avatar.png" alt="'.$comment->comment_author.'" width="40" height="40" />';
}
?>

And you need to change the two gravatar() function calls to look like this (remove the paramters):

gravatar();

If you prefer you can download a fixed comments.php to replace you existing one here:

coments.php.zip

These changes actually make a lot of the code redundant, as it’s not possible to display a Gravatar for a trackback (there is no email address)

Make the above changes and you should be able to see Gravatars for all your visitors!

I also note, it looks that as of WordPress v2.5, that gravatar support is built in. Note, if you use this the get_avatar() function does require the email address of the user as a parameter!

Update: Please note, the above download is for the old Frshy 2.06. Freshy 2.07 may have a different comments.php file, although it still has the bug so you will need to make the repair manually (let me know if you have any questions)!

Update 2: The bug is now fixed as of version 2.0.8

Comments
5 Comments »
Categories
Uncategorized
Tags
Freshy 2, gravatar, wordpress, WordPress 2.5
Comments rss Comments rss
Trackback Trackback

New WordPress Version & New Theme

April 8, 2008 | 11:47 am

I upgraded to WordPress 2.5 today, using the WordPress Automatic Upgrade plugin. I had a few problesm. The main one was although it asks for FTP details so that it can change the permissions, there are many files it doesn’t. The second problem I had was I didn’t read the bit that says “Click here to upgrade then come back”.

I also decided I ought to change the theme from the default. This was much easier. The main issues are with the Gallery integration – the gallery doesn’t look quite right.

On a similar subject, I can’t get the image frames bit of it working, which means if I want to change anything about WPG2, I have to enable image frames, change the settings, then disable image frames again to stop error messages being displayed. This may be because I am using an SVN version of gallery – I may look into this if I get a chance.

Comments
No Comments »
Categories
Uncategorized
Tags
Gallery, Theme, wordpress, WordPress 2.5, WPG2
Comments rss Comments rss
Trackback Trackback

Links

  • Izzy's Mum Nursing Clothing
  • Lara Rose Maternity Clothing
  • My LinkedIn Profile
  • Zopa

Tags

Android baby led weaning blogging cashback eBay email funny gadgets GDI GDI Goldrush Get Rich Quick google Google Wave Homepages Friends HTC Hero HTC Sense Isabel junk mail kayaking mobile MySearchFunds Norton Antivirus openid outdoors show Paternity phone photography post Post a Day rant review rodeo search security spam Symantec t-mobile the mobile outlet web Web Development welcome woopra wordpress WordPress 2.5 Yahoo

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox