- $condition = '`gid` IN (' . substr(str_repeat("?, ", count($group_ids)), 0, -2) . ')';
- if ($use_gcontact) {
- $sql = 'SELECT `gcontact`.`id` AS `contact-id` FROM `group_member`
- INNER JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id`
- INNER JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
- WHERE ' . $condition;
- $param_arr = array_merge([$sql], $group_ids);
- $stmt = call_user_func_array('dba::p', $param_arr);
- } else {
- $condition_array = array_merge([$condition], $group_ids);
- $stmt = dba::select('group_member', ['contact-id'], $condition_array);
+ $return = [];
+
+ $key = array_search(self::FOLLOWERS, $group_ids);
+ if ($key !== false) {
+ $followers = Contact::selectToArray(['id'], [
+ 'uid' => $uid,
+ 'rel' => [Contact::FOLLOWER, Contact::FRIEND],
+ 'network' => Protocol::SUPPORT_PRIVATE,
+ ]);
+
+ foreach ($followers as $follower) {
+ $return[] = $follower['id'];
+ }
+
+ unset($group_ids[$key]);