Merge branch 'MDL-77156-401' of https://github.com/lucaboesch/moodle into MOODLE_401_STABLE

This commit is contained in:
Jun Pataleta 2023-02-15 11:12:11 +08:00
commit e9e2c481fd
2 changed files with 17 additions and 1 deletions

View File

@ -403,7 +403,7 @@ class enrol_self_plugin extends enrol_plugin {
$a->coursename = format_string($course->fullname, true, array('context'=>$context));
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id";
if (trim($instance->customtext1) !== '') {
if (!is_null($instance->customtext1) && trim($instance->customtext1) !== '') {
$message = $instance->customtext1;
$key = array('{$a->coursename}', '{$a->profileurl}', '{$a->fullname}', '{$a->email}');
$value = array($a->coursename, $a->profileurl, fullname($user), $user->email);

View File

@ -140,3 +140,19 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
And I navigate to "Unenrol me from C1" in current page administration
And I click on "Continue" "button" in the "Confirm" "dialogue"
Then I should see "You are unenrolled from the course \"Course 1\""
@javascript
Scenario: Self-enrolment enabled with simultaneous guest access
Given I log in as "teacher1"
And I am on the "Course 1" "enrolment methods" page
And I click on "Enable" "link" in the "Self enrolment (Student)" "table_row"
And I click on "Edit" "link" in the "Guest access" "table_row"
And I set the following fields to these values:
| Allow guest access | Yes |
And I press "Save changes"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I navigate to "Enrol me in this course" in current page administration
And I click on "Enrol me" "button"
Then I should see "Topic 1"