personal group nav uses current user
This commit is contained in:
parent
64ab7b7d07
commit
0fef2cb66d
|
@ -54,7 +54,7 @@ class DefaultLocalNav extends Menu
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
$pn = new PersonalGroupNav($this->action, $user);
|
$pn = new PersonalGroupNav($this->action);
|
||||||
$this->submenu(_m('Home'), $pn);
|
$this->submenu(_m('Home'), $pn);
|
||||||
|
|
||||||
$sn = new SubGroupNav($this->action, $user);
|
$sn = new SubGroupNav($this->action, $user);
|
||||||
|
|
|
@ -53,23 +53,16 @@ class PersonalGroupNav extends Menu
|
||||||
*/
|
*/
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$user = null;
|
$user = common_current_user();
|
||||||
|
|
||||||
// FIXME: we should probably pass this in
|
if (empty($user)) {
|
||||||
|
throw new ServerException('Do not show personal group nav with no current user.');
|
||||||
$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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user_profile = $user->getProfile();
|
||||||
|
$nickname = $user->nickname;
|
||||||
|
$name = $user_profile->getBestName();
|
||||||
|
|
||||||
$this->out->elementStart('ul', array('class' => 'nav'));
|
$this->out->elementStart('ul', array('class' => 'nav'));
|
||||||
|
|
||||||
if (Event::handle('StartPersonalGroupNav', array($this))) {
|
if (Event::handle('StartPersonalGroupNav', array($this))) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user