Rob Ferrer’s Thoughts and Writings

I thought it was about time I started a blog!
  • rss
  • Home
  • About
  • Gallery

Freshy 2 & Gravatar Bugfix

June 16, 2008

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

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

Use your WordPress Blog as an OpenID

March 25, 2008

I read about OpenID a while ago, and decided now I have a blog, I should get myself an ID to let me log in to the various sites that support it.

I assumed there would be a WordPress plugin that let me do this, and I quickly found and installed WP-OpenID. To my disappointment I discovered that this plugin only adds the option for visitors to login using their OpenID, but not to use my blog as an OpenID. This does mean if you want to comment you can sign in with your OpenID however!

There are lots of 3rd party OpenID providers, and in fact I probably have more than one through other sites, but I wanted to keep everything separate from other providers, so I decided to set up my own.

Now, from here on, I am not reliant on WordPress, and this applies to any homepage or blog, whatever the platform. This is why I didn’t find many useful search results when searching for WordPress OpenID providers/plugins.

The solution is to install a little PHP application called phpMyID. There are lots of other blog posts that describe this process, but I will put a quick summary of what I did here. This assumes basic PHP/technical knowledge.

Firstly I downloaded phpMyID from here and unzipped it. The readme is pretty good - read it! I renamed MyID.config.php to index.php since I put it in it’s own directory (in fact own sub-domain: openid.robferrer.co.uk). Note, somewhat unusually, the config file is the main file which should be loaded, and is not included by another file as you would find in many other apps.

The readme tells you to upload the files and visit them. In fact this is only required if you are running PHP in safe mode, but I did it anyway (I also noticed a PHP error, but I’ll mention that later).

Follow the instructions to create the MD5 hash. I did this on a linux command line, and don’t like entering plain text passwords directly because it stays in the history. I could probably have worked out another way of typing the command, but the easiest solution is just to type ‘history -c’ after you’re done to clear the history.

I mentioned that I had a php error. This seems to be any configuration options that aren’t set (left as default). It works ok, but may (depending on your server settings) display warnings which prevents the headers being modified. The simplest solution to this is to turn off error/warning display in the php settings or (as I did), add the line “error_reporting(0);” to the top of your config file.

Other changes I made were to turn paranoid mode on (this asks you each time if you want to share your ‘identity’ with a site), and set up the sreg array with my details (to save you looking it up, the UK timezone is ‘Europe/London’, and country is ‘GB’). I’ll leave it up to you to decide how much of this information you want to fill in, bearing in mind any site which you log in to will be able to read it. I also set the idp_url, but it’s probably not needed

Re-upload the files and check you can log in. You may have to use the .htaccess (I didn’t), see the readme.

Finally, you presumably don’t want to enter your phpMyID url when you log in to a site, so put the following tags in to your homepage header:
<link rel=”openid.server” href=”http://openid.robferrer.co.uk/” />
<link rel=”openid.delegate” href=”http://openid.robferrer.co.uk/” />
(obviously replace http://openid.robferrer.co.uk/ with the URL of your phpMyID installation). If you want to use your blog URL, edit the WordPress header in Presentation->Theme Editor. You should now be able to enter your blog or homepage URL on any site that supports OpenID.

I had a small issue that stopped me logging in as www.robferrer.co.uk instead of openid.robferrer.co.uk. Not sure what the issue was. but this seems to be ok now using the settings described above.

I hope this helps someone searching for the same things as me!

Comments
No Comments »
Categories
Uncategorized
Tags
openid, phpmyopenid, wordpress
Comments rss Comments rss
Trackback Trackback

Pages

  • About
  • Gallery

Links

  • My LinkedIn Profile
  • Yuwie - social networking
  • Zopa: £30 free

Tags

car insurance cashback Churchill clipboard copy Direct Line easter flash gadgets Gallery google Homepages Friends insurance junk mail kayaking Lost mobile MySearchFunds openid outdoors show paste photography Photolate phpmyopenid Privilege rant review rodeo search security snow spam t-mobile Theme the mobile outlet TV web Weebls Stuff welcome Wii wordpress WordPress 2.5 WPG2 Yahoo yuwie

Recent Photos

DSC_0226
DSC_0221
DSC_0217
DSC_0210

Meta

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