[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Themes: restore user theme preference resolution

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a95634b9b997_38262742c5078f@gitlab-sidekiq-low-urgency-cpu-bound-v2-55667cdfbd-s7xtt.mail>

ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
c075be9f by MAGENE Sem Joel at 2026-08-31T11:04:19+00:00
[FIX] Themes: restore user theme preference resolution
---
* [FIX] Themes: restore user theme preference resolution

See merge request tikiwiki/tiki!11088

- - - - -


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/c075be9fd63bc62ba215e936371145b6f83c6b29

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c075be9fd63bc62ba215e936371145b6f83c6b29
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.