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

Enrolment plugins break when no role has student archetype

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.2
    • Fix Version/s: None
    • Component/s: Enrolments
    • Labels:
    • Affected Branches:
      MOODLE_35_STABLE

      Description

      Reproduction steps

      1. Ensure debug mode is on
      2. Browse to: Site administration > Users > Permissions > Define roles
      3. Edit the student role (click the cog)
      4. Change the role archetype to "Teacher (editing)
      5. Go back to the main site administration page - you should see a bunch of errors

      The issues seems to be that many enrolment plugins have this in their settings.php:

             $student = get_archetype_roles('student'); 
             $student = reset($student); 
             $settings->add(new admin_setting_configselect_with_advanced('enrol_mnet/roleid',            get_string('defaultrole', 'role'), '',            array('value'=>$student->id, 'adv'=>true), $options));
      

      When no role has the student archetype, then $student is not an object and $student->id fails.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cameron1729 cameron1729
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: