mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Can delete all the friends of a user
This commit is contained in:
		@@ -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
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user