From c750591782d1afd724a2d9b8ab49a7bf76912112 Mon Sep 17 00:00:00 2001 From: flashwave Date: Mon, 6 Jun 2022 18:30:02 +0200 Subject: [PATCH] Fixed user not found error page. --- public/profile.php | 5 ++--- templates/profile/index.twig | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/public/profile.php b/public/profile.php index 142882c1..669ecca1 100644 --- a/public/profile.php +++ b/public/profile.php @@ -23,14 +23,13 @@ try { $profileUser = User::findForProfile($userId); } catch(UserNotFoundException $ex) { http_response_code(404); - //Template::render('profile.index'); - echo 'User not found.'; + Template::render('profile.index'); return; } if($profileUser->isDeleted()) { http_response_code(404); - echo 'User not found.'; + Template::render('profile.index'); return; } diff --git a/templates/profile/index.twig b/templates/profile/index.twig index fbdaae0e..b3eb10c5 100644 --- a/templates/profile/index.twig +++ b/templates/profile/index.twig @@ -77,8 +77,8 @@ {% endif %}
- {% set profile_fields = profile_user.profileFields(not (profile_is_editing and perms.edit_profile)) %} - {% set show_profile_fields = profile_is_editing ? perms.edit_profile : profile_fields|default([])|length > 0 %} + {% set profile_fields = profile_user.profileFields(not (profile_is_editing and perms.edit_profile))|default([]) %} + {% set show_profile_fields = profile_is_editing ? perms.edit_profile : profile_fields|length > 0 %} {% set show_background_settings = profile_is_editing and perms.edit_background %} {% set show_birthdate = profile_is_editing and perms.edit_birthdate %} {% set show_sidebar = current_user is not defined or show_profile_fields or show_background_settings %}