Skip to content
Snippets Groups Projects
Commit 46cfdb66 authored by Alexander Bias's avatar Alexander Bias Committed by Kathrin Osswald
Browse files

Check if user is logged in before showing the switched role information box.

parent ec62b591
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@ moodle-theme_boost_campus
Changes
-------
### Unreleased
* 2017-09-22 - Check if user is logged in before showing the switched role information box.
### Release v3.2-r3
* 2017-09-19 - Changed naming of the former badgearea setting to imagearea to prevent mixing up with Moodle badges.
......
......@@ -187,6 +187,10 @@ class core_renderer extends \theme_boost\output\core_renderer {
// MODIFICATION START.
// Only use this if setting 'showswitchedroleincourse' is active.
if (get_config('theme_boost_campus', 'showswitchedroleincourse') === 'yes') {
// Check if user is logged in.
// If not, adding this section would make no sense and, even worse,
// user_get_user_navigation_info() will throw an exception due to the missing user object.
if (isloggedin()) {
$opts = \user_get_user_navigation_info($USER, $this->page);
// Role is switched.
if (!empty($opts->metadata['asotherrole'])) {
......@@ -211,6 +215,7 @@ class core_renderer extends \theme_boost\output\core_renderer {
$html .= html_writer::end_tag('div');
}
}
}
// MODIFICATION END.
return $html;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment