From 3693d0be50fcdcdd6d875725da2c08d5b5bed929 Mon Sep 17 00:00:00 2001 From: aftercase <74765798+aftercase@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:58:22 +0100 Subject: [PATCH] Fixed function getTotalPastes getTotalPastes Fix for profile page. --- includes/functions.php | 4 +++- profile.php | 2 +- theme/bulma/profile.php | 18 +++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index a1355d2..0a46899 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -279,7 +279,9 @@ function jsonView($paste_id, $p_title, $p_conntent, $p_code) { function getTotalPastes(PDO $conn, string $username) : int { - $query = $conn->prepare("SELECT COUNT(*) FROM pastes WHERE member = ?"); + $query = $conn->prepare("SELECT COUNT(*) AS total_pastes + FROM pastes INNER JOIN users ON users.id = pastes.user_id + WHERE users.username = ?"); $query->execute([$username]); return intval($query->fetch(PDO::FETCH_NUM)[0]); diff --git a/profile.php b/profile.php index 2357896..130efe2 100644 --- a/profile.php +++ b/profile.php @@ -64,7 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { updatePageViews($conn); -$total_pastes = getTotalPastes($conn, $user_username); +$total_user_pastes = getTotalPastes($conn, $user_username); // Theme require_once('theme/' . $default_theme . '/header.php'); diff --git a/theme/bulma/profile.php b/theme/bulma/profile.php index e15e0c5..d41fe68 100644 --- a/theme/bulma/profile.php +++ b/theme/bulma/profile.php @@ -20,7 +20,7 @@
-

+

' . $lang['mypastes'] . ''; ?>

" method="post">
+
+ +
+ + + + +
+
+
+ +
+
@@ -88,8 +102,6 @@
-
-