diff --git a/account/welcome/function.php b/account/welcome/function.php index ca87dc9..25f0fd6 100644 --- a/account/welcome/function.php +++ b/account/welcome/function.php @@ -421,4 +421,16 @@ function ReviewPost($con, $id, $reason){ } -?> \ No newline at end of file +function getMonthlyPublishedPosts($con, $month, $year) { + $query = "SELECT * FROM posts WHERE status='Published' AND MONTH(created_at) = $month AND YEAR(created_at) = $year ORDER BY created_at DESC"; + $run = mysqli_query($con, $query); + $data = array(); + + while($d = mysqli_fetch_assoc($run)) { + $data[] = $d; + } + + return $data; +} + +?> diff --git a/account/welcome/index.php b/account/welcome/index.php index 793a670..9421a66 100644 --- a/account/welcome/index.php +++ b/account/welcome/index.php @@ -1943,6 +1943,70 @@ function logout() { +
+

Monthly Published Posts

+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ +
+
+ No articles published in the selected month.

"; + } else { + echo ""; + echo ""; + echo ""; + foreach ($monthlyPosts as $post) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
TitleCategoryPublished Date
{$post['title']}" . getCategory($con, $post['category_id']) . "{$post['created_at']}
"; + } + } + ?> +
@@ -2044,4 +2108,4 @@ function logout() { ?> - \ No newline at end of file +