From 61960d36687cba7b4ace801fdd65829314bc0a13 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 21 Mar 2011 17:23:13 -0700 Subject: [PATCH] Add pending members list to group navigation, if group has joins moderated or if it has pending requests open --- lib/groupnav.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/groupnav.php b/lib/groupnav.php index a2dd6eac00..6a4f5f7e30 100644 --- a/lib/groupnav.php +++ b/lib/groupnav.php @@ -100,6 +100,18 @@ class GroupNav extends Menu $cur = common_current_user(); if ($cur && $cur->isAdmin($this->group)) { + $pending = $this->countPendingMembers(); + if ($pending || $this->group->join_policy == User_group::JOIN_POLICY_MODERATE) { + $this->out->menuItem(common_local_url('groupqueue', array('nickname' => + $nickname)), + // TRANS: Menu item in the group navigation page. Only shown for group administrators. + sprintf(_m('MENU','Pending members (%d)'), $pending), + // TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators. + // TRANS: %s is the nickname of the group. + sprintf(_m('TOOLTIP','%s pending members'), $nickname), + $action_name == 'groupqueue', + 'nav_group_pending'); + } $this->out->menuItem(common_local_url('blockedfromgroup', array('nickname' => $nickname)), // TRANS: Menu item in the group navigation page. Only shown for group administrators. @@ -141,4 +153,11 @@ class GroupNav extends Menu } $this->out->elementEnd('ul'); } + + function countPendingMembers() + { + $req = new Group_join_queue(); + $req->group_id = $this->group->id; + return $req->count(); + } }