From 73ad4012dff09801bfb8782a650b06b18d488b6d Mon Sep 17 00:00:00 2001 From: grandeljay Date: Sat, 28 Jan 2023 17:15:45 +0100 Subject: [PATCH] Fix undefined array key --- src/assets/js/parts/wish.js | 10 ++++++ src/pages/parts/wishlist.php | 61 +++++++++++++++--------------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/assets/js/parts/wish.js b/src/assets/js/parts/wish.js index 629a5b7c..128f6f99 100644 --- a/src/assets/js/parts/wish.js +++ b/src/assets/js/parts/wish.js @@ -44,6 +44,16 @@ $(function () { /** Show modal */ wish_details .modal({ + 'onShow' : function() { + var user_is_current = wishlist && wishlist.user === parseInt($('[name="user-id"]').val()); + + if (user_is_current) { + $('.ui.button.wish-fulfil').remove(); + } else { + $('.ui.button.wish-fulfilled').remove(); + $('.ui.dropdown.wish-options').remove(); + } + }, 'onVisible' : function() { /** * Dirty hack to change the default `display: block;` to diff --git a/src/pages/parts/wishlist.php b/src/pages/parts/wishlist.php index a70729b6..d3d816f0 100644 --- a/src/pages/parts/wishlist.php +++ b/src/pages/parts/wishlist.php @@ -7,6 +7,11 @@ namespace wishthis; ?> + +isLoggedIn()) { ?> + + +
@@ -248,51 +253,37 @@ namespace wishthis;
- + + + - $userIsCurrent = $_SESSION['user']->isLoggedIn() - && $_SESSION['user']->id === $wishlist->user; - ?> - - - - - - + - -