MDL-63683 enrol: Fix plugin settings when no role has student archetype
[moodle.git] / enrol / paypal / settings.php
index 66e0ae4..d9a3a7f 100644 (file)
@@ -66,7 +66,10 @@ if ($ADMIN->fulltree) {
         $student = get_archetype_roles('student');
         $student = reset($student);
         $settings->add(new admin_setting_configselect('enrol_paypal/roleid',
-            get_string('defaultrole', 'enrol_paypal'), get_string('defaultrole_desc', 'enrol_paypal'), $student->id, $options));
+            get_string('defaultrole', 'enrol_paypal'),
+            get_string('defaultrole_desc', 'enrol_paypal'),
+            $student->id ?? null,
+            $options));
     }
 
     $settings->add(new admin_setting_configduration('enrol_paypal/enrolperiod',