From a06dc576213c65ad1e86505eca71c2df8f7a4a34 Mon Sep 17 00:00:00 2001 From: Chimo Date: Fri, 4 Dec 2015 15:47:40 +0000 Subject: [PATCH] Fix "pending members" group list --- classes/User_group.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/classes/User_group.php b/classes/User_group.php index 344394a682..7bfb16e27f 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -220,24 +220,19 @@ class User_group extends Managed_DataObject */ function getRequests($offset=0, $limit=null) { - $qry = - 'SELECT profile.* ' . - 'FROM profile JOIN group_join_queue '. - 'ON profile.id = group_join_queue.profile_id ' . - 'WHERE group_join_queue.group_id = %d ' . - 'ORDER BY group_join_queue.created DESC '; + $rq = new Group_join_queue(); + $rq->group_id = $this->id; + + $members = new Profile(); + + $members->joinAdd(['id', $rq, 'profile_id']); if ($limit != null) { - if (common_config('db','type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; - } + $members->limit($offset, $limit); } - $members = new Profile(); + $members->find(); - $members->query(sprintf($qry, $this->id)); return $members; } -- 2.39.5