diff --git a/enrol/manual/tests/behat/welcomemessage.feature b/enrol/manual/tests/behat/welcomemessage.feature index 7f421c2ca6d..ceb3600d1ff 100644 --- a/enrol/manual/tests/behat/welcomemessage.feature +++ b/enrol/manual/tests/behat/welcomemessage.feature @@ -109,7 +109,7 @@ Feature: A course welcome message will be sent to the user when they are enrolle And I should see "Your email address: first@example.com" And I should see "Your first name: First" And I should see "Your last name: User" - And I should see "Your course role: student" + And I should see "Your course role: Student" # Login as second user and check the notification. When I am on the "C1" "course" page logged in as user2 Then I should see "1" in the "#nav-notification-popover-container [data-region='count-container']" "css_element" @@ -120,4 +120,4 @@ Feature: A course welcome message will be sent to the user when they are enrolle And I should see "Your email address: second@example.com" And I should see "Your first name: Second" And I should see "Your last name: User" - And I should see "Your course role: student" + And I should see "Your course role: Student" diff --git a/enrol/self/tests/behat/welcomemessage.feature b/enrol/self/tests/behat/welcomemessage.feature index f18fe3f37c7..8142ec16400 100644 --- a/enrol/self/tests/behat/welcomemessage.feature +++ b/enrol/self/tests/behat/welcomemessage.feature @@ -99,7 +99,7 @@ Feature: A course welcome message will be sent to the user when they auto-enrol And I should see "Your email address: first@example.com" And I should see "Your first name: First" And I should see "Your last name: User" - And I should see "Your course role: student" + And I should see "Your course role: Student" # Login as second user and check the notification. And I log in as "user2" And I am on "Course 1" course homepage @@ -112,4 +112,4 @@ Feature: A course welcome message will be sent to the user when they auto-enrol And I should see "Your email address: second@example.com" And I should see "Your first name: Second" And I should see "Your last name: User" - And I should see "Your course role: student" + And I should see "Your course role: Student" diff --git a/lib/enrollib.php b/lib/enrollib.php index 7b2cac48c1c..ec8ee5fb29c 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -3655,11 +3655,7 @@ abstract class enrol_plugin { $context = context_course::instance($instance->courseid); $user = core_user::get_user($userid); $course = get_course($instance->courseid); - $courserole = $DB->get_field( - table: 'role', - return: 'shortname', - conditions: ['id' => $instance->roleid], - ); + $courserole = $DB->get_record('role', ['id' => $instance->roleid]); $a = new stdClass(); $a->coursename = format_string($course->fullname, true, ['context' => $context, 'escape' => false]); @@ -3689,7 +3685,7 @@ abstract class enrol_plugin { $user->email, $user->firstname, $user->lastname, - $courserole, + role_get_name($courserole, $context), ]; $message = str_replace($placeholders, $values, $message); if (strpos($message, '<') === false) {