Ticket #5775 (closed enhancement: fixed)

Opened 3 months ago

Last modified 2 months ago

Pluggable get_avatar()

Reported by: ryan Assigned to: ryan
Priority: normal Milestone: 2.5
Component: General Version: 2.5
Severity: normal Keywords: avatar
Cc:

Description

So that themes can rely on an avatar function always being available, let's introduce a get_avatar() pluggable function. By default it can use gravatar (disclaimer, my company owns gravatar), but plugins can replace the function altogether or hook onto a filter to use a different service. We might need new options to select avatar rating and allow avatars to not be displayed at all.

Attachments

get_avatar.diff (1.3 kB) - added by ryan on 02/06/08 18:31:53.
md5hash.patch (0.6 kB) - added by Viper007Bond on 02/08/08 01:23:44.
Save a couple CPU cycles
5775-urlencode.patch (0.8 kB) - added by spikeyslam on 02/28/08 21:40:32.
urlencode($default) when needed

Change History

02/06/08 00:15:57 changed by ryan

Sample implementation. Not yet tested.

02/06/08 00:27:21 changed by DD32

apologies for the off-topic: With Gravatar, would it be possible in the future to allow setting it for a domain? I use contact+<sitename>@host for most commenting/signing up to blogs.. So its utterly useless to me at present :P

As to this ticket, It sounds like a good idea for themes, but, i feel by default it might be best not to have the gravatar stuff in there, I'd like it to be linked to my wordpress.com username instead somehow, if that means i have to add a plugin to enable wordpress.com integration, or add a plugin to enable gravaar integration then thats fine by me, so maybe WordPress should just have a stub in place?

(But In other words, I'd rather it linked to wordpress.com than gravatar.com)

02/06/08 00:52:08 changed by ryan

wordpress.com doesn't have any external avatar lookup. wordpress.com avatars might someday be served from gravatar anyway.

02/06/08 01:00:35 changed by DD32

wordpress.com doesn't have any external avatar lookup. wordpress.com avatars might someday be served from gravatar anyway.

Ah ok.

02/06/08 17:56:22 changed by josephscott

I haven't seen any way to set the avatar_rating option yet.

02/06/08 18:31:53 changed by ryan

  • attachment get_avatar.diff added.

02/06/08 18:40:02 changed by ryan

The UI isn't there yet. I'm thinking of "Show Avatars" <yes|no> and "Show Avatars Rated:" <g|pg|r|x> options in Options->Reading. I can rough in something and let the designers decide on layout and wording.

I updated the patch to return false if the 'show_avatars' option is not true. Themes would need to check for a false return and style accordingly.

02/07/08 06:07:13 changed by ryan

(In [6748]) get_avatar(). see #5775

02/07/08 06:45:45 changed by Viper007Bond

  • version set to 2.5.

"Show Avatars Rated" should be more clear. I know what it means, but noobs may not. Either that, it needs some explanation text.

02/07/08 06:49:50 changed by ryan

Agreed. I'm just roughing it in for now. Suggestions welcome.

02/07/08 06:58:39 changed by ryan

(In [6749]) Gonna serve default avatars from gravatar. see #5775

02/07/08 07:00:06 changed by ryan

Removed the default avatar images. We're going to serve those off of gravatar. The images aren't on gravatar yet so the gravatar branded default will show for now.

02/08/08 01:23:44 changed by Viper007Bond

  • attachment md5hash.patch added.

Save a couple CPU cycles

02/08/08 07:09:02 changed by ryan

(In [6756]) Precompute the hash of the unknown avatar user to save an md5 call. Props Viper007Bond. see #5775

02/16/08 12:20:01 changed by JeremyVisser

  • type changed from defect to enhancement.

Shouldn't the "Don't show Avatars" / "Show Avatars" option box be a checkbox instead?

Or is there an intention to add more options to this box? If not, it should definitely become a checkbox.

(follow-up: ↓ 19 ) 02/18/08 17:37:35 changed by ryan

A checkbox is fine. Anyone want to patch it up? Also, anyone have a suggestion for better text than "Show Avatars Rated"?

02/20/08 20:57:21 changed by ryan

(In [6945]) Allow comment object to be passed to get_avatar() for convenience. see #5775

02/20/08 20:58:59 changed by ryan

(In [6946]) Allow comment object to be passed to get_avatar() for convenience. see #5775

02/28/08 21:39:24 changed by spikeyslam

$default is getting urlencoded to soon and prevents usage as an img src later in the function.

02/28/08 21:40:32 changed by spikeyslam

  • attachment 5775-urlencode.patch added.

urlencode($default) when needed

02/28/08 22:01:57 changed by ryan

(In [7096]) urlencode only when needed. Props spikeyslam. see #5775

(in reply to: ↑ 14 ) 03/14/08 12:14:48 changed by djr

Replying to ryan:

A checkbox is fine. Anyone want to patch it up? Also, anyone have a suggestion for better text than "Show Avatars Rated"?

Choose Avatar rating

03/26/08 08:11:40 changed by matt

  • status changed from new to closed.
  • resolution set to fixed.