Skip to content

Commit

Permalink
MDL-82359 Navigation: ignore navadduserpostslinks if no forum
Browse files Browse the repository at this point in the history
The admin setting navadduserpostslinks (default on) causes debug
warnings due to missing language strings on every page while logged in
if forum is uninstalled.

This is not the worst problem if running without forum installed,
because you can just turn off the admin setting, but it makes it
impossible to run Behat tests.

This change means that the option does nothing if forum is uninstalled.
This is a small change just to make it work without significantly
altering anything.
  • Loading branch information
sammarshallou committed Jul 22, 2024
1 parent ecfdc1e commit a96488e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a96488e

Please sign in to comment.