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/emotes/index.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'public/emotes') diff --git a/public/emotes/index.php b/public/emotes/index.php index 9a33d1d..ad4df09 100644 --- a/public/emotes/index.php +++ b/public/emotes/index.php @@ -338,13 +338,15 @@ if (CLIENT_REQUIRES_JSON) { $link = "#"; $show_private_badge = false; $badge = null; + $custom_badge = null; if ($emote->get_uploaded_by()) { - $stmt = $db->prepare("SELECT u.username, up.private_profile, r.name AS role_name, r.badge_id AS role_badge_id + $stmt = $db->prepare("SELECT u.username, up.private_profile, r.name AS role_name, r.badge_id AS role_badge_id, ub.badge_id AS custom_badge_id FROM users u INNER JOIN user_preferences up ON up.id = u.id LEFT JOIN role_assigns ra ON ra.user_id = u.id LEFT JOIN roles r ON r.id = ra.role_id + LEFT JOIN user_badges ub ON ub.user_id = u.id WHERE u.id = ? "); $stmt->execute([$emote->get_uploaded_by()]); @@ -355,6 +357,7 @@ if (CLIENT_REQUIRES_JSON) { $username = $row["username"]; $link = "/users.php?id=" . $emote->get_uploaded_by(); $badge = ["role_name" => $row["role_name"], "role_badge_id" => $row["role_badge_id"]]; + $custom_badge = $row["custom_badge_id"]; } } @@ -370,6 +373,10 @@ if (CLIENT_REQUIRES_JSON) { echo ' ## ' . $badge['; } + if ($custom_badge) { + echo " "; + } + echo ', get_created_at()); echo ' UTC">about ' . format_timestamp(time() - $emote->get_created_at()) . " ago"; -- cgit v1.2.3