From 46629116cc9bdc39c1046dbfd4ef1477bf814511 Mon Sep 17 00:00:00 2001 From: Jetha Chan Date: Tue, 16 Sep 2014 13:41:41 +0800 Subject: [PATCH] MDL-46523 navigation: add body class when roleswitched and not in initial install --- lib/outputrenderers.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 531be806482..c3f9fafd6a5 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -827,6 +827,13 @@ class core_renderer extends renderer_base { $this->page->add_body_class('userloggedinas'); } + // If the user is logged in, and we're not in initial install, + // check to see if the user is role-switched and add the appropriate + // CSS class to the body element. + if (!during_initial_install() && isloggedin() && is_role_switched($this->page->course->id)) { + $this->page->add_body_class('userswitchedrole'); + } + // Give themes a chance to init/alter the page object. $this->page->theme->init_page($this->page); -- 2.43.0