From 4e29d4041e7cf254041e22d2052e94a7c53c9066 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 14 May 2025 21:40:06 +0500 Subject: feat: personal badges --- public/users.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'public/users.php') diff --git a/public/users.php b/public/users.php index fced3eb..fcfd92b 100644 --- a/public/users.php +++ b/public/users.php @@ -280,6 +280,18 @@ $fav_reactions = $stmt->fetchAll(PDO::FETCH_ASSOC); // getting favorite emote $fav_emote = 1; +// getting custom badge +$stmt = $db->prepare("SELECT b.* FROM badges b + INNER JOIN user_badges ub ON ub.user_id = ? + WHERE b.id = ub.badge_id +"); +$stmt->execute([$user->id()]); + +$custom_badge = null; +if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $custom_badge = $row; +} + if ($is_json) { header("Content-type: application/json"); echo json_encode([ @@ -299,7 +311,8 @@ if ($is_json) { "active_emote_set_id" => $active_emote_set["id"], "emote_sets" => $emote_sets, "uploaded_emotes" => $uploaded_emotes, - "actions" => $actions + "actions" => $actions, + "custom_badge" => $custom_badge ] ]); exit; @@ -327,8 +340,14 @@ if ($is_json) {