email parameter to gravatar is case-sensitive

I just installed the gravatar plugin to my comments display, I was able to see Tiffany‘s gravatar but not mine, I went in and edited my comment, changed my email address to all lower case, it worked. Looking at the code for the plugin, it uses an MD5 hash for the email parameter, so uppercase get hashed to a different key as lowercase… Very strange, not sure why they didn’t just use the email address as the hash key. Anyway, to get it to work I “downcased” the email address, but obviously this would not work if you registered with a mixed-case email address at gravatar.

Another thing to note is that to have multiple email addresses associated with a single account you have to “upgrade” to their “premium” service, this is kindda strange, they should at least allow like 3 email addresses. I just ended up registering 3 times with 3 different emails… So the single address restriction did not do anything but waste Amazon S3 storage and database records…

If you’re not a programmer and would like to get the plugin to downcase, here’s the modified version of the plugin, all I added was the strtolower() method.

function gravatar($rating = false, $size = false, $default = false,
  $border = false) {
  global $comment;
  $out = "http://www.gravatar.com/avatar.php?gravatar_id=".md5(
    strtolower($comment->comment_author_email));
...

Technorati Tags:

3 thoughts on “email parameter to gravatar is case-sensitive

  1. Tiffany

    Cool! I think gravatar has some bugs though… I remember sometimes my icon wouldn’t show up. But then again, that might be my CSS stuff being screwed up.

    Reply
  2. Good Time Tribe

    It seems as though gravatar is now doing a lowercase on your e-mail address during registration. I was unable to register mine with an upper case because gravatar believes the address already exists. Can anyone else confirm?

    Reply

Leave a Reply to Tiffany Cancel reply