Allow hooks to define avatar before Gravatar processing
|Reported by:||jakemgold||Owned by:|
The get_avatar() function allows for developers to override avatar output in two ways. You can replace the function (pluggable) - not a good idea in my view, especially if you still want the ability to fallback and use Gravatar sometimes. You can also filter the output at the very end of the function with the 'get_avatar' hook. This works fine, but in highly common instances where a plug-in might want to override the avatar on a case by case basis, this forces each get_avatar call to needlessly process through the entire default avatar / Gravatar "construction".
Admittedly, that processing is mostly trivial string manipulation and conditionals with an md5 in the mix, but it still seems like needless overhead in instances where many avatars might get called in a comments thread or authors list.
Proposing a pretty trivial change that allows an avatar to be defined by a filter hook before proceeding through Gravatar / default avatar processing, skipping over all of that if one is, in fact, defined.
My inspiration for this is an attempt to improve the performance of my fairly popular Simple Local Avatars plug-in, that allows users to upload local avatars: http://wordpress.org/extend/plugins/simple-local-avatars/