From 14866f6b256cef0724bdede849a9d5b863f05a8c Mon Sep 17 00:00:00 2001 From: masiv_ Date: Thu, 12 Feb 2026 20:03:54 -0300 Subject: [PATCH] Add option to make comments invisible (not having to delete them). This is for moderation purposes. --- includes/chat_reading_model.inc.php | 2 +- includes/comments_db.sql | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/chat_reading_model.inc.php b/includes/chat_reading_model.inc.php index f5f87ab..1d34023 100644 --- a/includes/chat_reading_model.inc.php +++ b/includes/chat_reading_model.inc.php @@ -3,7 +3,7 @@ declare(strict_types=1); function retrieve_chat_history(object $pdo){ - $query = "SELECT username, content, date_sent FROM comments;"; + $query = "SELECT username, content, date_sent FROM comments WHERE visible=true;"; $stmt = $pdo->prepare($query); $stmt->execute(); diff --git a/includes/comments_db.sql b/includes/comments_db.sql index 5c9fe0a..9347113 100644 --- a/includes/comments_db.sql +++ b/includes/comments_db.sql @@ -2,6 +2,7 @@ CREATE TABLE comments ( id INT(11) NOT NULL AUTO_INCREMENT, username VARCHAR(255) NOT NULL, content TEXT NOT NULL, + visible BOOLEAN DEFAULT 1, date_sent DATETIME DEFAULT CURRENT_TIME, users_id INT(11) NOT NULL, PRIMARY KEY (id), -- 2.49.1