From a85cb89789fd59ab4240c9fbb7b8d2dde8f5d99a Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 10 May 2025 02:51:16 +0500 Subject: upd: user page design --- public/users.php | 255 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 129 insertions(+), 126 deletions(-) (limited to 'public/users.php') diff --git a/public/users.php b/public/users.php index 7146cd1..430fda5 100644 --- a/public/users.php +++ b/public/users.php @@ -252,39 +252,10 @@ $stmt->execute([$user->id()]); $contributions += intval($stmt->fetch()[0]); // getting status -$status = "... i don't know who am i"; - $stmt = $db->prepare("SELECT * FROM roles r INNER JOIN role_assigns ra ON ra.user_id = ? WHERE ra.role_id = r.id"); $stmt->execute([$user->id()]); -if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - $status = ''; - $status .= $row["name"]; - $status .= ''; -} +$role = $stmt->fetch(PDO::FETCH_ASSOC) ?? null; // getting reactions $stmt = $db->prepare("SELECT rate, COUNT(*) AS c FROM ratings WHERE user_id = ? GROUP BY rate ORDER BY c DESC"); @@ -295,6 +266,12 @@ $fav_reactions = $stmt->fetchAll(PDO::FETCH_ASSOC); // getting favorite emote $fav_emote = 1; +// User preferences +$stmt = $db->prepare("SELECT * FROM user_preferences WHERE id = ?"); +$stmt->execute([$user->id()]); + +$user_preferences = $stmt->fetch(PDO::FETCH_ASSOC) ?? null; + if ($is_json) { header("Content-type: application/json"); echo json_encode([ @@ -306,7 +283,7 @@ if ($is_json) { "joined_at" => $user->joined_at(), "last_active_at" => $user->last_active_at(), "stats" => [ - "status_id" => $status, + "role" => $role, "contributions" => $contributions, "favorite_reaction_id" => $fav_reaction, "favorite_emote_id" => $fav_emote @@ -330,45 +307,60 @@ if ($is_json) { +
+
+
+
- -
+
'; - ?> - - + + sprintf("background: rgba(%s);", $bg_color_split[1]), + "gradient" => sprintf("background: linear-gradient(0deg, rgba(%s), rgba(%s));", $bg_color_split[1], $bg_color_split[2]), + "img" => sprintf("background-image: url('%s')", $bg_color_split[1]), + default => "" + }; + + if (is_file($_SERVER["DOCUMENT_ROOT"] . $badge_path)): ?> +
+
+ <?php echo $role[" width="54" + height="54"> +
+
+

+ Role +
+
+ +
- - - -
I am
Joined
- - -
- Send a message - id() . '">Report user'; - } - ?> + +
+ + + + + +
- - -
- -
+
+ +
+
+ '; + echo '' . $emote_row['; + echo '

' . $emote_row["code"] . '

'; + echo '

' . ($emote_row["uploaded_by"] == null ? (ANONYMOUS_DEFAULT_NAME . "*") : $emote_row["uploaded_by"]["username"]) . '

'; + echo ''; + echo ''; + } + } else { + echo '

No emotes found... ' . ((($_SESSION["user_id"] ?? "") == $id) ? 'Start adding emotes and they will appear here! :)

' : '

'); + } + } else { + echo "

This user doesn't have active emote set.

"; + } + ?> +
+
+ +
+
- - - -
-
- '; - echo '' . $emote_row['; - echo '

' . $emote_row["code"] . '

'; - echo '

' . ($emote_row["uploaded_by"] == null ? (ANONYMOUS_DEFAULT_NAME . "*") : $emote_row["uploaded_by"]["username"]) . '

'; - echo ''; - echo ''; - } - } else { - echo '

No emotes found... ' . ((($_SESSION["user_id"] ?? "") == $id) ? 'Start adding emotes and they will appear here! :)

' : '

'); - } - ?> -
-
- - - -
- -
- '; - echo '' . $emote_row['; - echo '

' . $emote_row["code"] . '

'; - echo ''; - } - ?> -
-
- - + -
+
+ +
+ +
+ '; + echo '' . $emote_row['; + echo '

' . $emote_row["code"] . '

'; + echo ''; + } + ?> +
+
+ + \ No newline at end of file -- cgit v1.2.3