]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Utility Profile::current() to get current user's profile
authorEvan Prodromou <evan@status.net>
Mon, 11 Apr 2011 15:16:30 +0000 (11:16 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 11 Apr 2011 15:16:30 +0000 (11:16 -0400)
classes/Profile.php

index ac008877c4bcae1d18ac3656e00913a0e054b3bf..a47744a124dc26104b472ef62ed6ddba6870a90e 100644 (file)
@@ -1304,4 +1304,15 @@ class Profile extends Memcached_DataObject
 
         return true;
     }
+
+    static function current()
+    {
+        $user = common_current_user();
+        if (empty($user)) {
+            $profile = null;
+        } else {
+            $profile = $user->getProfile();
+        }
+        return $profile;
+    }
 }