]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
hook for getting profile avatars
authorEvan Prodromou <evan@status.net>
Thu, 14 Apr 2011 15:33:10 +0000 (11:33 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 14 Apr 2011 15:33:10 +0000 (11:33 -0400)
EVENTS.txt
classes/Profile.php

index d1e36ad906e53386215d42c97f086ce9337f49ed..7819d9042bbece468effe6722680f1334fce1ba4 100644 (file)
@@ -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
index a47744a124dc26104b472ef62ed6ddba6870a90e..6c7c18234525f4ab6c5a8794f99161f960c77382 100644 (file)
@@ -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()