Can create a frienship request

This commit is contained in:
Pierre
2017-12-21 19:24:25 +01:00
parent d5eda3c1d4
commit 235428982d
2 changed files with 59 additions and 0 deletions

View File

@ -186,6 +186,28 @@ class friends {
return count($response) > 0;
}
/**
* Send a friendship request
*
* @param $userID The ID of the user creating the request
* @param $targetID The target of the friendship request
* @return TRUE in case of success / FALSE else
*/
public function send_request(int $userID, int $targetID) : bool {
//Prepare the insertion
$tableName = $this->friendsTable;
$values = array(
"ID_personne" => $targetID,
"ID_amis" => $userID,
"actif" => 0
);
//Try to perform the request
return CS::get()->db->addLine($tableName, $values) == true;
}
/**
* Check wether a user has sent a friendship
* request to another friend