Use gravatar as a fallback for missing files

This commit is contained in:
Evan Prodromou 2011-04-14 13:05:11 -04:00
parent c7a4aaddfc
commit 52493a9a2b

View File

@ -32,7 +32,8 @@ class GravatarPlugin extends Plugin
{
function onEndProfileGetAvatar($profile, $size, &$avatar)
{
if (empty($avatar)) {
if (empty($avatar) ||
(!empty($avatar->filename) && !file_exists(Avatar::path($avatar->filename)))) {
$user = $profile->getUser();
if (!empty($user) && !empty($user->email)) {
// Fake one!