From: Evan Prodromou Date: Tue, 1 Mar 2011 21:04:36 +0000 (-0500) Subject: personal group nav uses current user X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0fef2cb66d5e19524a6bb253baff48045bf2f84c;p=quix0rs-gnu-social.git personal group nav uses current user --- diff --git a/lib/defaultlocalnav.php b/lib/defaultlocalnav.php index 93eaf73393..b42d3a804c 100644 --- a/lib/defaultlocalnav.php +++ b/lib/defaultlocalnav.php @@ -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); diff --git a/lib/personalgroupnav.php b/lib/personalgroupnav.php index d72a865677..6a31358596 100644 --- a/lib/personalgroupnav.php +++ b/lib/personalgroupnav.php @@ -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))) {