Update friends post texts authorization status.

This commit is contained in:
Pierre
2018-03-11 16:40:41 +01:00
parent 6cc90d281f
commit 5d47e64f92
2 changed files with 53 additions and 0 deletions

View File

@ -343,6 +343,29 @@ class friends {
return CS::get()->db->updateDB($tableName, $conditions, $newValues, $conditionsValues);
}
/**
* Update the posts authorization status for a friendship
*
* @param int $userID The ID of the user updating the authorization status
* @param int $friendID The ID of the target friend
* @param boolean $allow The new authorization status
* @return bool TRUE in case of success / FALSE else
*/
public function set_can_post_texts(int $userID, int $friendID, bool $allow) : bool {
//Update the table
$tableName = $this->friendsTable;
$conditions = "ID_personne = ? AND ID_amis = ?";
$conditionsValues = array($userID, $friendID);
$newValues = array(
"autoriser_post_page" => $allow ? 1 : 0
);
//Perform the request
return CS::get()->db->updateDB($tableName, $conditions, $newValues, $conditionsValues);
}
/**
* Count the number of friends of a user
*