comment ordering and timestamp format change

This commit is contained in:
Zdenek Borovec 2024-04-29 01:38:42 +02:00
parent 14521fccd8
commit 22588626f2

View file

@ -35,7 +35,7 @@ class BlogpostComment
</div> </div>
</div> </div>
<div class=\"comment-child-wrapper\"> <div class=\"comment-child-wrapper\">
", $this->poster_name, date("Y-m-d", strtotime($this->timestamp)), ", $this->poster_name, date("Y-m-d H:i", strtotime($this->timestamp)),
$this->content); $this->content);
if($this->children != null) { if($this->children != null) {
@ -56,7 +56,7 @@ class BlogpostComment
$stmt = $conn->prepare("SELECT comment_id, poster_id, timestamp, $stmt = $conn->prepare("SELECT comment_id, poster_id, timestamp,
content, username FROM (blogpost_comments INNER JOIN users ON content, username FROM (blogpost_comments INNER JOIN users ON
poster_id = user_id) WHERE blogpost_id = :blogpost_id poster_id = user_id) WHERE blogpost_id = :blogpost_id
AND parent_id = :comment_id;"); AND parent_id = :comment_id ORDER BY timestamp ASC;");
// Bind and execute the comment select // Bind and execute the comment select
$stmt->bindParam(":blogpost_id", $this->blogpost_id); $stmt->bindParam(":blogpost_id", $this->blogpost_id);
@ -196,7 +196,7 @@ function load_comments($conn, $blogId) {
$stmt = $conn->prepare("SELECT comment_id, poster_id, timestamp, content, $stmt = $conn->prepare("SELECT comment_id, poster_id, timestamp, content,
username FROM (blogpost_comments INNER JOIN users ON username FROM (blogpost_comments INNER JOIN users ON
poster_id = user_id) WHERE blogpost_id = :blogpost_id AND poster_id = user_id) WHERE blogpost_id = :blogpost_id AND
parent_id IS NULL;"); parent_id IS NULL ORDER BY timestamp ASC;");
// Bind and execute the comment select // Bind and execute the comment select
$stmt->bindParam(":blogpost_id", $blogId); $stmt->bindParam(":blogpost_id", $blogId);