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

"My Courses" section of Navigation block missing some courses, if you have "Show all courses" and "Show course categories" activated

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Deferred
    • Icon: Minor Minor
    • None
    • 2.0.4, 2.1.1
    • Navigation
    • Any
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • Hide

      1. Create a Moodle instance with two course categories.
      2. Create two courses in one of the categories.
      3. Enrol a user in both of those courses.
      4. Turn on the settings $CFG->navshowcategories and $CFG->navshowallcourses (these are both under "Site Administration > Appearance > Navigation").
      5. Go to the My Moodle page and add a Navigation block to the page.
      6. Log in as the user enroled in step #3.
      7. Go to the My Moodle page. Look for the Navigation block and expand the "My Courses" tree.

      Expected result: You should see both of the courses in the "My Courses" tree.

      Show
      1. Create a Moodle instance with two course categories. 2. Create two courses in one of the categories. 3. Enrol a user in both of those courses. 4. Turn on the settings $CFG->navshowcategories and $CFG->navshowallcourses (these are both under "Site Administration > Appearance > Navigation"). 5. Go to the My Moodle page and add a Navigation block to the page. 6. Log in as the user enroled in step #3. 7. Go to the My Moodle page. Look for the Navigation block and expand the "My Courses" tree. Expected result: You should see both of the courses in the "My Courses" tree.

      The problem is that the "My Courses" section of the Navigation block is not showing all of a user's courses. I haven't been able to figure out why some of the courses show and others don't, or how to set up a fresh Moodle instance to make sure this happens.

      But, I have been able to track down the source of the problem to the changes made by commit 1f7907dac31cfd52a383779650326ea1895d297a (MDL-27809) to global_navigation::add_course(). Specifically, if I remove lines 1998 through 2001 (the part prefaced with the comment "// We found the course... we can return it now "), then the full list of My Courses shows up again, although this also causes the page to have some errors about duplicate nodes, and indeed to list some courses twice in the "Courses" section, so it's not a full solution.

      UPDATE: I've determined that this only occurs if you've activated the settings $CFG->navshowcategories and $CFG->navshowallcourses

      Replication steps:

      1. Activate the settings $CFG->navshowcategories and $CFG->navshowallcourses
      2. Create a Moodle instance with two course categories.
      3. Create two courses in one of the categories.
      4. Enrol a user in both of those courses.
      5. Turn on the settings $CFG->navshowcategories and $CFG->navshowallcourses (these are both under "Site Administration > Appearance > Navigation").
      6. Go to the My Moodle page and add a Navigation block to the page.
      7. Log in as the user enroled in step #3.
      8. Go to the My Moodle page. Look for the Navigation block and expand the "My Courses" tree.

      Actual result: You'll see only one of the two courses listed in the My Courses tree.

            samhemelryk Sam Hemelryk
            aaronw Aaron Wells (Inactive)
            Votes:
            15 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.