[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [BP][FIX] Themes: restore user theme preference resolution

"MAGENE Sem Joel \(@Jomagene\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a9577329b850_3818e304264@gitlab-sidekiq-low-urgency-cpu-bound-v2-74dc959445-8ldrg.mail>

MAGENE Sem Joel pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
067302a4 by MAGENE Sem Joel at 2026-08-31T12:36:22+00:00
[BP][FIX] Themes: restore user theme preference resolution
---
* [FIX] Themes: restore user theme preference resolution
---
* [FIX] Themes: restore user theme preference resolution

See merge request tikiwiki/tiki!11088

(cherry picked from commit c075be9fd63bc62ba215e936371145b6f83c6b29)

See merge request tikiwiki/tiki!11100

- - - - -


1 changed file:

- lib/Theme/ThemeLib.php


Changes:

=====================================
lib/Theme/ThemeLib.php
=====================================
@@ -57,23 +57,22 @@ class ThemeLib extends TikiLib
      */
     public static function getActiveThemeAndOption(): array
     {
-        global $prefs, $smarty;
+        global $prefs, $smarty, $user;
         $section = Sections::getCurrentSection();
 
-        // lib/setup/theme.php writes the resolved theme back into $prefs['theme'], so snapshot
-        // it once per request instead of re-reading it - otherwise a later section change
-        // would reuse an earlier call's resolved admin theme as its base.
-        static $baseTheme;
-        static $baseThemeOption;
-        if (! isset($baseTheme)) {
-            $baseTheme = $prefs['theme'] ?? '';
-            $baseThemeOption = $prefs['theme_option'] ?? '';
-        }
         //Initialize variables for the actual theme and theme option to be displayed
-        $theme_active = $baseTheme;
-        $theme_option_active = $baseThemeOption;
-
-        // User theme previously set up in lib/setup/user_prefs.php
+        $theme_active = $prefs['site_theme'] ?? ($prefs['theme'] ?? '');
+        $theme_option_active = $prefs['site_theme_option'] ?? ($prefs['theme_option'] ?? '');
+
+        //consider User theme
+        if (($prefs['change_theme'] ?? 'n') === 'y') {
+            $tikilib = TikiLib::lib('tiki');
+            $user_theme = $tikilib->get_user_preference($user, 'theme', '');
+            if ($user_theme !== '') {
+                $theme_active = $user_theme;
+                $theme_option_active = $tikilib->get_user_preference($user, 'theme_option', '');
+            }
+        }
 
         //consider Group theme
         if (! empty($prefs['useGroupTheme']) && $prefs['useGroupTheme'] == 'y') {



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/067302a47b25aeebe09c8234e9ff478ed554abd3

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/067302a47b25aeebe09c8234e9ff478ed554abd3
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.