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

Enrolment plugins break when no role has student archetype

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Testing instructions

      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 - Make sure no errors are shown

      Additionally, for each of the following plugin in: Site administration > Plugins > Enrolments > Manage enrol plugins:

      1. Cohort sync
      2. External database
      3. Enrolment on payment (note this is only available from 3.10 onwards)
      4. Manual enrolments
      5. MNet remote enrolments
      6. PayPal
      7. Self enrolment

      Visit their settings page and make sure no errors are shown

      Show
      Testing instructions Ensure debug mode is on Browse to: Site administration > Users > Permissions > Define roles Edit the student role (click the cog) Change the role archetype to "Teacher (editing) Go back to the main site administration page - Make sure no errors are shown Additionally, for each of the following plugin in: Site administration > Plugins > Enrolments > Manage enrol plugins: Cohort sync External database Enrolment on payment (note this is only available from 3.10 onwards) Manual enrolments MNet remote enrolments PayPal Self enrolment Visit their settings page and make sure no errors are shown
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_35_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull from Repository:
    • Pull 3.9 Branch:
    • Pull 3.10 Branch:
      MDL-63683-310
    • Pull 3.11 Branch:
      MDL-63683-311
    • Pull Master Branch:
      MDL-63683-master

      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

        1. MDL-63683.jpg
          22 kB
          Anna Carissa Sadia
        2. MDL-63683 (2).jpg
          76 kB
          Anna Carissa Sadia

          Issue Links

            Activity

              People

              Assignee:
              davidmatamoros David Matamoros
              Reporter:
              cameron1729 cameron1729
              Peer reviewer:
              Paul Holden Paul Holden
              Integrator:
              Víctor Déniz Falcón Víctor Déniz Falcón
              Tester:
              Anna Carissa Sadia Anna Carissa Sadia
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/21

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours, 20 minutes
                  3h 20m