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

Error thrown when trying to view forum posts for a hidden course



    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.5.3, 2.6.4
    • None
    • Forum, Navigation
    • None


      If a course has Visible set to "Hide", then the link from the Navigation block to a user's forum posts will throw an error.

      Steps to reproduce:

      1. Create a course with a forum activity (simple forum is fine).
      2. Enrol a student in the course
      3. Log in to the course as the student.
      4. As the student, post in the forum activity.
      5. Enrol a teacher in the course
      6. Log in as the teacher.
      7. Set the course's visibility to hidden (e.g. Course Settings->Visible->Hide). Save your changes.
      8. From the course's main page, in the Navigation block, under current course, click "Participants"
      9. From the participants page, click the student's name (to get to the student's course profile)
      10. In the Navigation block, under current course, under the student's name, expand Forum posts, and click "Posts"
      11. You will be presented with an error forum/notenrolled
        With debugging on, the error gives this information:


        More information about this error

        Debug info:
        Error code: notenrolled
        $a contents:
        Stack trace:
        line 476 of /lib/setuplib.php: moodle_exception thrown
        line 8309 of /mod/forum/lib.php: call to print_error()
        line 121 of /mod/forum/user.php: call to forum_get_posts_by_user()

      12. Set the course's visibility to shown (e.g. Course settings->Visible->Show). Save your changes
      13. Repeat steps 8, 9, and 10.
      14. Note that the teacher is able to view the student's posts.


        Issue Links



              Unassigned Unassigned
              matt.rice Matt Rice
              Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              2 Vote for this issue
              5 Start watching this issue