Can delete all the friends of a user

This commit is contained in:
Pierre 2018-05-10 08:42:58 +02:00
parent 8f628327cf
commit 7ca5a29888

View File

@ -383,6 +383,26 @@ class friends {
}
/**
* Delete all the friends of a user, including friendship requests
*
* @param int $userID The ID of the target user
* @return bool TRUE for a success / FALSE else
*/
public function deleteAllUserFriends(int $userID) : bool {
//Delete the friend from the database
$tableName = $this->friendsTable;
$conditions = "ID_personne = ? OR ID_amis = ?";
$condValues = array($userID, $userID);
//Try to perform the request
$success = CS::get()->db->deleteEntry($tableName, $conditions, $condValues);
return $success;
}
/**
* Parse friend informations from the database
*