From 373e22c99f4e85fc84be4a3a5925a152a0674421 Mon Sep 17 00:00:00 2001 From: Giraffaman Date: Fri, 5 Jan 2024 15:45:16 +0100 Subject: [PATCH] suppress image pool info in /view - related to #23 --- ext/pools/main.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ext/pools/main.php b/ext/pools/main.php index 476e8ad41..2bbf63bef 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -473,24 +473,26 @@ public function onUserBlockBuilding(UserBlockBuildingEvent $event) */ public function onDisplayingImage(DisplayingImageEvent $event) { - global $config; + global $config, $user; - if ($config->get_bool(PoolsConfig::INFO_ON_VIEW_IMAGE)) { - $imageID = $event->image->id; - $poolsIDs = $this->get_pool_ids($imageID); + if($user->is_logged_in()) { + if ($config->get_bool(PoolsConfig::INFO_ON_VIEW_IMAGE)) { + $imageID = $event->image->id; + $poolsIDs = $this->get_pool_ids($imageID); - $show_nav = $config->get_bool(PoolsConfig::SHOW_NAV_LINKS, false); + $show_nav = $config->get_bool(PoolsConfig::SHOW_NAV_LINKS, false); - $navInfo = []; - foreach ($poolsIDs as $poolID) { - $pool = $this->get_single_pool($poolID); + $navInfo = []; + foreach ($poolsIDs as $poolID) { + $pool = $this->get_single_pool($poolID); - $navInfo[$pool->id] = [ - "info" => $pool, - "nav" => $show_nav ? $this->get_nav_posts($pool, $imageID) : null, - ]; + $navInfo[$pool->id] = [ + "info" => $pool, + "nav" => $show_nav ? $this->get_nav_posts($pool, $imageID) : null, + ]; + } + $this->theme->pool_info($navInfo); } - $this->theme->pool_info($navInfo); } }