diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 24a175bb3214..1721ce23bffc 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -2589,7 +2589,8 @@ protected function load_for_user($user=null, $forceforcontext=false) { } } - if (!empty($CFG->navadduserpostslinks)) { + // Only if the forum links are enabled and forum is installed... + if (!empty($CFG->navadduserpostslinks) && \core_component::get_component_directory('mod_forum') !== null) { // Add nodes for forum posts and discussions if the user can view either or both // There are no capability checks here as the content of the page is based // purely on the forums the current user has access too. @@ -5201,7 +5202,8 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr $profilenode = $mainpage->add(get_string('profile'), new moodle_url('/user/profile.php', array('id' => $user->id)), self::TYPE_SETTING, null, 'myprofile'); - if (!empty($CFG->navadduserpostslinks)) { + // Only if the forum links are enabled and forum is installed... + if (!empty($CFG->navadduserpostslinks) && \core_component::get_component_directory('mod_forum') !== null) { // Add nodes for forum posts and discussions if the user can view either or both // There are no capability checks here as the content of the page is based // purely on the forums the current user has access too.