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.
i will try this out, been meaning to do this for ages!
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.
[...] more reading on the get_avatar function, please read Ryan Boren’s Avatars in WordPress 2.5, which he covers several additional points not mentioned [...]
How should this be added to existing themes? Is there any sample code of how it would normally be added to a theme?
Oh ye! I wanted to use Gravaters on my blog for ages but I’m so lazy. Looking forward to stable 2.5.
what if we want to use MyBlogLog avatars?
[...] Gravatars have been integrated into WordPress 2.5’s core, thus eliminating the need for a plugin! I knew this would come, seeing that Automattic bought the Gravatar service last October. [...]
[...] aici. [...]
Christopher: click on the documentation link in Ryan’s post…
Cooool
Social WordPress is coming!
I really need some examples not snippets by themselves…. something that says insert x code before or after x on the index/home.php etc.
[...] …”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.” Read the full post [...]
[...] tillegg er det selvfølgelig den nye template taggen, get_avatar() som blant annet kan brukes til å vise gravatar i [...]
[...] Built-in: Ryan Boren makes it official, avatars using the Gravatar Plugin is now incorporated into WordPress. Weblog Tools [...]
@Jenny
It will require a plugin, but this will be possible in 2.5.
[...] more reading on the get_avatar function, please read Ryan Boren’s Avatars in WordPress 2.5, which he covers several additional points not mentioned [...]
[...] Built-in: Ryan Boren makes it official, avatars using the Gravatar Plugin is now incorporated into WordPress. Weblog Tools [...]
Yay!
Have a look at lines 66-68 of Tarski’s comments.php file for an example of this in action.
I want to use MyBlogLog avatar
[...] due out next week) is that when installed under WordPress 2.5 or newer, it will use the new core get_avatar() function to generate the image tag. And since get_avatar() is a pluggable function, other plugins [...]
Great news, looking forward to the new release
Hmm, will it let me /add/ a service /as well/ as gravatar? Will have to experiment.
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.
[...] due out next week) is that when installed under WordPress 2.5 or newer, it will use the new core get_avatar() function to generate the image tag. And since get_avatar() is a pluggable function, other plugins [...]
very nice.
[...] template tag: precious_comment_gravatar: this uses the new WordPress template tag get_avatar if you use WordPreciousss with WP 2.5, on older WP version it will use the old gravatar code used [...]
[...] WTC写了一篇教程,Ryan看到后说“啊,原来有人写了,我不必再写了。”但是仅靠这两篇文章没法让一个不通PHP的人弄清楚要怎么用,所以我下午琢磨了许久,终于在自己的模板上搞定了。 [...]
This code was postd to WP testers, I triied it out and it works for me quite nicely on my test site:
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.
[...] adapted my theme to use new built-in support for Gravatar and optimal titles instead of the plugins I was using [...]
pretty damn cool…
with the brand new dashboard~~
cool feature!
[...] both weblogtoolscollection.com and boren.nu shows, one of the new features in WordPress 2.5 is to have default avatar support in the form of [...]
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?
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?