Latest posts thread can includes groups posts.

This commit is contained in:
Pierre HUBERT
2018-07-20 15:31:21 +02:00
parent af304d7409
commit a9f4afdcbc
3 changed files with 47 additions and 4 deletions

View File

@ -254,6 +254,29 @@ class GroupsComponent {
}
/**
* Get the list of groups a user is following
*
* @param int $userID The ID of the target group
* @return array The IDs of the groups followed by the user
*/
public function getListFollowedByUser(int $userID) : array {
$result = db()->select(
self::GROUPS_MEMBERS_TABLE,
"WHERE user_id = ? AND following = 1",
array($userID),
array("groups_id")
);
//Parse the list of IDs
$list = array();
foreach($result as $el)
$list[] = $el["groups_id"];
return $list;
}
/**
* Count the number of a kind of membership in a group
*