diff --git a/course/user.php b/course/user.php index aadbd89bca4..ccf39f7d1b9 100644 --- a/course/user.php +++ b/course/user.php @@ -149,9 +149,10 @@ switch ($mode) { if ($course->id == SITEID) { $activenode = $PAGE->navigation->find('user' . $user->id, null); } else { - $currentcoursenode = $PAGE->navigation->find('currentcourse', null); + $currentcoursenode = $PAGE->navigation->find($course->id, navigation_node::TYPE_COURSE); $activenode = $currentcoursenode->find_active_node(); } + // Check to see if the active node is a user name. if (!preg_match('/^user\d{0,}$/', $activenode->key)) { // No user name found. $userurl = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $course->id)); diff --git a/user/tests/behat/user_grade_navigation.feature b/user/tests/behat/user_grade_navigation.feature index 7997a97ab16..e32158c3b8d 100644 --- a/user/tests/behat/user_grade_navigation.feature +++ b/user/tests/behat/user_grade_navigation.feature @@ -64,7 +64,7 @@ Feature: The student can navigate to their grades page and user grade report. Scenario: Log in as a parent and view a childs grades. When I log in as "admin" And I am on site homepage - And I follow "Turn editing on" + And I turn editing mode on And I add the "Mentees" block And I navigate to "Define roles" node in "Site administration > Users > Permissions" And I click on "Add a new role" "button" @@ -94,7 +94,7 @@ Feature: The student can navigate to their grades page and user grade report. | Course name | Grade | | Course 2 | - | | Course 1 | 217.00 | - And I follow "Course 1" + And I click on "Course 1" "link" in the "region-main" "region" And the following should exist in the "user-grade" table: | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total | | Test assignment one | 75.00 % | 150.00 | 0–300 | 50.00 % | 37.50 % |