From 117f875d6287b03131e75a839e563b05b15ecd48 Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Thu, 8 Apr 2021 11:03:17 -0600 Subject: Add ability to delete your posts --- model/Post.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'model/Post.php') diff --git a/model/Post.php b/model/Post.php index 91cd3be..308b5ac 100644 --- a/model/Post.php +++ b/model/Post.php @@ -15,7 +15,7 @@ function add_quote($dbc, $thread_id, $matches) { $reply = mysqli_fetch_assoc($result); if (empty($reply)) { - return '
Invalid quote!
'; + return '
This post has been deleted
'; } $id = $id + 1; @@ -59,7 +59,16 @@ class Post { } function display_content($dbc) { - echo '
#' . $this->id . ' Posted by ' . $this->author->name . ' on ' . date('m/d/Y g:ia', strtotime($this->date)) . '
'; + echo '
#' . $this->id . ''; + echo ' Posted by ' . $this->author->name . ''; + echo ' on ' . date('m/d/Y g:ia', strtotime($this->date)); + if (isset($_SESSION['signed_in']) && $_SESSION['user_id'] == $this->author->id) { + echo ''; + echo '[Edit] '; + echo '[Delete]'; + echo''; + } + echo '
'; $post_content = $this->content; $thread_id = $this->id; -- cgit v1.2.3