]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
personal group nav uses current user
authorEvan Prodromou <evan@status.net>
Tue, 1 Mar 2011 21:04:36 +0000 (16:04 -0500)
committerEvan Prodromou <evan@status.net>
Tue, 1 Mar 2011 21:04:36 +0000 (16:04 -0500)
lib/defaultlocalnav.php
lib/personalgroupnav.php

index 93eaf73393cc4f71a2fa14f607a760f276732305..b42d3a804c31a1f22c7d146c808452eb4300fde2 100644 (file)
@@ -54,7 +54,7 @@ class DefaultLocalNav extends Menu
         $user = common_current_user();
 
         if (!empty($user)) {
-            $pn = new PersonalGroupNav($this->action, $user);
+            $pn = new PersonalGroupNav($this->action);
             $this->submenu(_m('Home'), $pn);
 
             $sn = new SubGroupNav($this->action, $user);
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))) {