Get the list of followers of a group

This commit is contained in:
Pierre HUBERT 2018-07-20 13:37:32 +02:00
parent ffcef67b70
commit d99b4c7f18

View File

@ -231,6 +231,29 @@ class GroupsComponent {
return $this->multipleDBToGroupMember($members); return $this->multipleDBToGroupMember($members);
} }
/**
* Get the list of members of the group that follows it
*
* @param int $groupID The ID of the target group
* @return array The list of members
*/
public function getListFollowers(int $groupID) : array {
$result = db()->select(
self::GROUPS_MEMBERS_TABLE,
"WHERE groups_id = ? AND following = 1",
array($groupID),
array("user_id")
);
//Parse the list of IDs
$list = array();
foreach($result as $el)
$list[] = $el["user_id"];
return $list;
}
/** /**
* Count the number of a kind of membership in a group * Count the number of a kind of membership in a group
* *