]> git.mjollnir.org Git - moodle.git/commitdiff
Choose the correct theme for SSO-authenticated users. Roaming themes
authordonal72 <donal72>
Tue, 2 Oct 2007 16:14:39 +0000 (16:14 +0000)
committerdonal72 <donal72>
Tue, 2 Oct 2007 16:14:39 +0000 (16:14 +0000)
lib/weblib.php

index 46dc072553c240f6e1808df930494c72c4bbcbb8..1cec341490631e9f4392e4c4c8dcbf544adc6cad 100644 (file)
@@ -2707,6 +2707,12 @@ function current_theme() {
         $themeorder = $CFG->themeorder;
     }
 
+    if ($USER->mnethostid != $CFG->mnet_localhost_id) {
+        require_once($CFG->dirroot.'/mnet/peer.php');
+        $mnet_peer = new mnet_peer();
+        $mnet_peer->set_id($USER->mnethostid);
+    }
+
     $theme = '';
     foreach ($themeorder as $themetype) {
 
@@ -2744,11 +2750,19 @@ function current_theme() {
                 break;
             case 'user':
                 if (!empty($CFG->allowuserthemes) and !empty($USER->theme)) {
-                    $theme = $USER->theme;
+                    if ($USER->mnethostid != $CFG->mnet_localhost_id && $mnet_peer->force_theme == 1 && $mnet_peer->theme != '') {
+                        $theme = $mnet_peer->theme;
+                    } else {
+                        $theme = $USER->theme;
+                    }
                 }
                 break;
             case 'site':
-                $theme = $CFG->theme;
+                if ($USER->mnethostid != $CFG->mnet_localhost_id && $mnet_peer->force_theme == 1 && $mnet_peer->theme != '') {
+                    $theme = $mnet_peer->theme;
+                } else {
+                    $theme = $CFG->theme;
+                }
                 break;
             default:
                 /// do nothing