Can invite a user to join a group.

This commit is contained in:
Pierre HUBERT
2018-09-02 14:49:15 +02:00
parent 1ef7f662e5
commit 4e0b5c5fc9
2 changed files with 46 additions and 0 deletions

View File

@ -354,6 +354,22 @@ class GroupsComponent {
);
}
/**
* Invite a user to join a group
*
* @param int $userID The ID of the target user
* @param int $groupID The ID of the target group
* @param bool TRUE for a success / FALSE else
*/
public function sendInvitation(int $userID, int $groupID) : bool {
$member = new GroupMember();
$member->set_userID($userID);
$member->set_group_id($groupID);
$member->set_time_sent(time());
$member->set_level(GroupMember::INVITED);
return $this->insertMember($member);
}
/**
* Check whether a user received an invitation or not
*