]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add pending members list to group navigation, if group has joins moderated or if...
authorBrion Vibber <brion@pobox.com>
Tue, 22 Mar 2011 00:23:13 +0000 (17:23 -0700)
committerBrion Vibber <brion@pobox.com>
Tue, 22 Mar 2011 00:23:13 +0000 (17:23 -0700)
lib/groupnav.php

index a2dd6eac0087e39687049a2a836925b01c9d2311..6a4f5f7e30c508c5d5ec958b6aa580a86a0a3a8c 100644 (file)
@@ -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();
+    }
 }