]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/personalgroupnav.php
personal group nav uses current user
[quix0rs-gnu-social.git] / lib / personalgroupnav.php
index d72a8656775ab43be795fcfa3efad5cc95d27ab9..6a31358596e540b4e62a16f855815af62fd62465 100644 (file)
@@ -53,23 +53,16 @@ class PersonalGroupNav extends Menu
      */
     function show()
     {
-        $user = null;
+        $user         = common_current_user();
 
-        // FIXME: we should probably pass this in
-
-        $action = $this->action->trimmed('action');
-        $nickname = $this->action->trimmed('nickname');
-
-        if ($nickname) {
-            $user = User::staticGet('nickname', $nickname);
-            $user_profile = $user->getProfile();
-            $name = $user_profile->getBestName();
-        } else {
-            // @fixme can this happen? is this valid?
-            $user_profile = false;
-            $name = $nickname;
+        if (empty($user)) {
+            throw new ServerException('Do not show personal group nav with no current user.');
         }
 
+        $user_profile = $user->getProfile();
+        $nickname     = $user->nickname;
+        $name         = $user_profile->getBestName();
+
         $this->out->elementStart('ul', array('class' => 'nav'));
 
         if (Event::handle('StartPersonalGroupNav', array($this))) {