hook for getting profile avatars

This commit is contained in:
Evan Prodromou 2011-04-14 11:33:10 -04:00
parent b511b59f15
commit a0b4282cbf
2 changed files with 20 additions and 3 deletions

View File

@ -1366,3 +1366,12 @@ EndLocalURL: before resolving a local url for an action
- &$addSession: whether to add session variable - &$addSession: whether to add session variable
- &$url: resulting URL to local resource - &$url: resulting URL to local resource
StartProfileGetAvatar: When getting an avatar for a profile
- $profile: profile
- $size: size of the avatar
- &$avatar: avatar
EndProfileGetAvatar: After getting an avatar for a profile
- $profile: profile
- $size: size of the avatar
- &$avatar: avatar

View File

@ -68,9 +68,17 @@ class Profile extends Memcached_DataObject
if (is_null($height)) { if (is_null($height)) {
$height = $width; $height = $width;
} }
return Avatar::pkeyGet(array('profile_id' => $this->id,
'width' => $width, $avatar = null;
'height' => $height));
if (Event::handle('StartProfileGetAvatar', array($this, $width, &$avatar))) {
$avatar = Avatar::pkeyGet(array('profile_id' => $this->id,
'width' => $width,
'height' => $height));
Event::handle('EndProfileGetAvatar', array($this, $width, &$avatar));
}
return $avatar;
} }
function getOriginalAvatar() function getOriginalAvatar()