From 06cba13b8cf9d9faaf05180ee4a763e6c359b4ee Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 2 Feb 2023 16:40:03 +0000 Subject: [PATCH] set featured_id to 0 if the featured image is deleted --- ext/featured/main.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/featured/main.php b/ext/featured/main.php index 0f87114f..9ecae59d 100644 --- a/ext/featured/main.php +++ b/ext/featured/main.php @@ -71,6 +71,15 @@ class Featured extends Extension } } + public function onImageDeletion(ImageDeletionEvent $event) + { + global $config; + if($event->image->id == $config->get_int("featured_id")) { + $config->set_int("featured_id", 0); + $config->save(); + } + } + public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) { global $user;