[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [FIX] Sections: An alternative fix for body category classes regression

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]> Thu, 09 Jul 2026 14:00:17 +0000
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a4fa9713e6a9_39a3c7bc933a7@gitlab-sidekiq-low-urgency-cpu-bound-v2-778c9fcf89-6zj92.mail>

Jonny Bradley pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
702302b5 by Jonny Bradley at 2026-07-09T13:52:45+00:00
[FIX] Sections: An alternative fix for body category classes regression
---
* [FIX] Sections: An alternative fix for body category classes regression
---
* [FIX] sections: An alternative fix for yet another Sections regression to address categories not being added to the `body` tag classes feature.
Reverts !10425, hope that's ok @bsfez?

See merge request tikiwiki/tiki!10673


(cherry picked from commit 5a8df819a32f6d59b627cc056dd0f66f9b5d9b30)

2a659dfd [FIX] sections: An alternative fix for yet another Sections regression to...

Co-authored-by: Jonny Bradley <[email protected]>

See merge request tikiwiki/tiki!10678

- - - - -


1 changed file:

- lib/setup/categories.php


Changes:

=====================================
lib/setup/categories.php
=====================================
@@ -10,23 +10,26 @@ if (basename($_SERVER['SCRIPT_NAME']) === basename(__FILE__)) {
     die('This script may only be included.');
 }
 
+global $prefs;
 if ($prefs['feature_categories'] == 'y' && $prefs['categories_used_in_tpl'] == 'y') {
-    $categlib = TikiLib::lib('categ');
+    Sections::onSectionChange(function ($section) {
 
-    $objectCategoryIds = [];
-    $objectCategoryIdsNoJail = [];
+        $objectCategoryIds = [];
+        $objectCategoryIdsNoJail = [];
 
-    $currentObject = Sections::currentObject();
-    if ($currentObject) {
-        $objectCategoryIds = $categlib->get_object_categories($currentObject['type'], $currentObject['object']);
-        $objectCategoryIdsNoJail = $categlib->get_object_categories(
-            $currentObject['type'],
-            $currentObject['object'],
-            -1,
-            false
-        );
-    }
+        $currentObject = Sections::currentObject();
+        if ($currentObject) {
+            $categlib = TikiLib::lib('categ');
+            $objectCategoryIds = $categlib->get_object_categories($currentObject['type'], $currentObject['object']);
+            $objectCategoryIdsNoJail = $categlib->get_object_categories(
+                $currentObject['type'],
+                $currentObject['object'],
+                -1,
+                false
+            );
+        }
 
-    $smarty->assign_by_ref('objectCategoryIds', $objectCategoryIds);
-    // use in smarty {if isset($objectCategoryIds) and in_array(54, $objectCategoryIds)} My stuff ..{/if}
+        TikiLib::lib('smarty')->assign_by_ref('objectCategoryIds', $objectCategoryIds);
+        // use in smarty {if isset($objectCategoryIds) and in_array(54, $objectCategoryIds)} My stuff ..{/if}
+    });
 }



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/702302b5f7db70e7d39818e187caa10194ab28a7

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/702302b5f7db70e7d39818e187caa10194ab28a7
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs