Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27058

Removing Forum from navigation block.

    Details

    • Database:
      Any
    • Testing Instructions:
      Hide

      1. Log in as an admin
      2. Check navadduserpostslinks is enabled
      3. Check that there is a `Forum posts` link in the `My profile` section of the navigation
      4. Disable navadduserpostslinks
      5. Check that there is no longer a `Forum posts` link

      Show
      1. Log in as an admin 2. Check navadduserpostslinks is enabled 3. Check that there is a `Forum posts` link in the `My profile` section of the navigation 4. Disable navadduserpostslinks 5. Check that there is no longer a `Forum posts` link
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull Master Branch:
      wip-MDL-27058-master

      Description

      This issue is related somewhat to issue MDL-26967 which appears to be fixed by PULL-562. Also, see this (and other) forum posts: http://moodle.org/mod/forum/discuss.php?d=171315

      I believe the Forum links are confusing for the user when the capability is not present and results in multiple questions from students and guests asking how to use the forums. Disabling "See all user posts" (moodle/user:readuserposts) and "View discussions" (mod/forum:viewdiscussion) under "Site administration->Users->Permissions->Define roles->[Role]" should remove these options from the navigation block.

      Here is a suggested patch that does that for 2.X:

      Replace the following code within "/lib/navigationlib.php":

      // 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.
      $forumtab = $usernode->add(get_string('forumposts', 'forum'));
      $forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs));
      $forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', array_merge($baseargs, array('mode'=>'discussions'))));

      with this code:

      // Add nodes for forum posts and discussions if the user can view either or both
      $context = get_context_instance(CONTEXT_USER, $USER->id);
      if ($iscurrentuser && (has_capability('moodle/user:readuserposts', $context) || has_capability('mod/forum:viewdiscussion', $context))) {
      $forumtab = $usernode->add(get_string('forumposts', 'forum'));
      if (has_capability('moodle/user:readuserposts', $context))

      { $forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs)); }

      if (has_capability('mod/forum:viewdiscussion', $context))

      { $forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', array_merge($baseargs, array('mode'=>'discussions')))); }

      }

      Peace.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/11