Avatars in WordPress 2.5

Weblog Tools Collection has documented the get_avatar() function present in WordPress 2.5 so that I don’t have to. Big thanks. I can scrap the avatar post I haven’t got around to writing and instead answer some of the questions that popped up in the comments to the WTC post.

Gravatar is the service used by default. get_avatar() is completely pluggable, however, so any service can be used. get_avatar() is built-in so that themes will have some fixed API on which they can rely, regardless of whatever avatar service is being used behind-the-scenes.

In addition to accepting an email address or user ID, get_avatar() accepts an entire comment object. This is a convenience for using get_avatar() in the comments loop.

The avatar support in 2.5 does not attempt to add avatars into your existing themes. Themes must be written to use get_avatar(). Dynamic addition of avatars is left to plugins.

Avatars are displayed in several places in the admin. They will show up when managing comments, for example.

Display of avatars can be completely turned off via a preference. When turned off, no attempt is made to connect to an avatar service.

36 thoughts on “Avatars in WordPress 2.5

  1. This is so awesome. I’m very glad to see Gravatar-by-default in WordPress, and I look forward to seeing what sorts of plugins are created making use of the new functionality.

  2. If you wanted to use myBlogLog with this new function, you would need to use a plugin to do so. As of yet there hasn’t been on written.

    If you’re wondering why it uses Gravatars, let’s not forget who owns Gravatars now.

  3. How about caching of the avatars? I just recently started to use Gravatar2 plugin which caches the images from gravatar.com which is nice feature. Any info on caching in wp2.5? Btw I tested wp2.5RC1 and so far been liking it. Just hope this avatar/gravatar feature won’t be messed up.

  4. Most of my blog’s readers are in China, to them, it is too slow to download the avatar pics. But i think avatar pics are very cute, still want to use this features. What should I do? Does this kind of plugins exist, that it can cache every avatar pics on the local server?

  5. Hi, I was wondering if anyone’s had any issues with the avatar-default class being assigned if the default image is used. Ryan, I notice that’s what’s happening here on your site, but for some reason, that class is not being assigned to my default avatars when they’re displayed.

    Basically I’m trying to hide the image completely if the default image is displayed, instead of displaying anything. I tried using a blank transparent GIF, but then the text wraps around an empty space. Anyone know how to hide the avatar completely if the default is shown?

Leave a Reply