personal group nav uses current user

This commit is contained in:
Evan Prodromou 2011-03-01 16:04:36 -05:00
parent 64ab7b7d07
commit 0fef2cb66d
2 changed files with 8 additions and 15 deletions

View 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);

View 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))) {