diff --git a/EVENTS.txt b/EVENTS.txt index d1e36ad906..7819d9042b 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -1366,3 +1366,12 @@ EndLocalURL: before resolving a local url for an action - &$addSession: whether to add session variable - &$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 diff --git a/classes/Profile.php b/classes/Profile.php index a47744a124..6c7c182345 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -68,9 +68,17 @@ class Profile extends Memcached_DataObject if (is_null($height)) { $height = $width; } - return Avatar::pkeyGet(array('profile_id' => $this->id, - 'width' => $width, - 'height' => $height)); + + $avatar = null; + + 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()