mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 08:35:18 +00:00
Update friends post texts authorization status.
This commit is contained in:
@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user