X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fgroupsnav.php;h=8e5d1a39fb60584f29b001103c74f5fb8ce0ca24;hb=7fb02674e5ba9b3ad369a837499ba50ed1c7465e;hp=bedb9f9b6ebd7b9a557cd954677025c1f3af3118;hpb=cb183359e23ae7a5cfb483fa06c6c4b7a8b05fff;p=quix0rs-gnu-social.git diff --git a/lib/groupsnav.php b/lib/groupsnav.php index bedb9f9b6e..8e5d1a39fb 100644 --- a/lib/groupsnav.php +++ b/lib/groupsnav.php @@ -58,7 +58,7 @@ class GroupsNav extends MoreMenu function haveGroups() { - return (!empty($this->groups) && ($this->groups->N > 0)); + return ($this->groups instanceof User_group && $this->groups->N > 0); } function tag() @@ -70,9 +70,10 @@ class GroupsNav extends MoreMenu { $items = array(); - while ($this->groups->fetch()) { - $items[] = array('showgroup', - array('nickname' => $this->groups->nickname), + while ($this->groups instanceof User_group && $this->groups->fetch()) { + $items[] = array('placeholder', + array('nickname' => $this->groups->nickname, + 'mainpage' => $this->groups->homeUrl()), $this->groups->getBestName(), $this->groups->getBestName() ); @@ -84,8 +85,29 @@ class GroupsNav extends MoreMenu function seeAllItem() { return array('usergroups', array('nickname' => $this->user->nickname), + // TRANS: Link description for seeing all groups. _('See all'), - _('See all groups you belong to')); + // TRANS: Link title for seeing all groups. + _('See all groups you belong to.')); + } + + function item($actionName, $args, $label, $description, $id=null, $cls=null) + { + if ($actionName != 'placeholder') { + return parent::item($actionName, $args, $label, $description, $id, $cls); + } + + if (empty($id)) { + $id = $this->menuItemID('showgroup', array('nickname' => $args['nickname'])); + } + + $url = $args['mainpage']; + + $this->out->menuItem($url, + $label, + $description, + $this->isCurrent($actionName, $args), + $id, + $cls); } - }