From: Evan Prodromou Date: Thu, 14 Apr 2011 15:33:10 +0000 (-0400) Subject: hook for getting profile avatars X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a0b4282cbf1d36c80a27121dded1e9fa718fa19d;p=quix0rs-gnu-social.git hook for getting profile avatars --- 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()