From d857bf78c0f8639eae9e21ffe4e04ee68e94d04b Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 7 May 2025 14:42:30 +0500 Subject: feat: display default avatar if user doesn't have one --- public/account/index.php | 18 ++++++++++++++---- public/users.php | 39 ++++++++++++++++++++++++++++++--------- src/partials.php | 18 ++++++++++++------ 3 files changed, 56 insertions(+), 19 deletions(-) diff --git a/public/account/index.php b/public/account/index.php index 8ecce33..5455727 100644 --- a/public/account/index.php +++ b/public/account/index.php @@ -88,13 +88,23 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {

Profile

Profile picture

- " id="pfp" width="64" - height="64"> + '; + } else { + echo "

You don't have profile picture

"; + } + ?>

Profile banner

- " id="banner" width="192" - height="108"> + '; + } else { + echo "

You don't have profile banner

"; + } + ?>

Username

diff --git a/public/users.php b/public/users.php index 933ada4..f1aa3e7 100644 --- a/public/users.php +++ b/public/users.php @@ -86,9 +86,15 @@ if ($id == "" && $alias_id == "") { $last_active = format_timestamp($diff); } - echo ''; - echo ''; - echo '' . $row["username"] . ''; + echo ''; + echo ''; + echo '' . $row["username"] . ''; echo "$last_active ago"; echo ''; } @@ -322,13 +328,28 @@ if ($is_json) {
-
- -

username() ?>

+

User

+ id())) { + echo ' style="background-image: url(\'/static/userdata/banners/' . $user->id() . '\');">'; + } else { + echo '>'; + } + + echo 'id())) { + echo 'userdata/avatars/' . $user->id(); + } else { + echo 'img/defaults/profile_picture.png'; + } + echo '" width="96" height="96">'; + echo '

' . $user->username() . '

'; + + echo ''; + ?>
diff --git a/src/partials.php b/src/partials.php index 07f2636..38e63bb 100644 --- a/src/partials.php +++ b/src/partials.php @@ -72,12 +72,18 @@ function html_navigation_bar() - " class="links" style="margin-left:auto;"> - Signed in as " width="24" height="24" /> - - '; + echo 'Signed in as ' . $_SESSION["user_name"] . ' '; + echo ''; + echo ''; } ?>
-- cgit v1.2.3