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

Bug with LDAP and Multi-enrolment.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Component/s: Enrolments
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_16_STABLE

      Description

      here's the scenario.

      manual enrolment set to default at site level, ldap enrolment also enabled.

      individual course settings:

      Enrolment Plugins: Site default (internal enrolment)

      course enrollable: No

      I thought ldap interactive enrolment still worked when course enrollable is set to No - if you set course enrollable to Yes - then manual enrolment is enabled.

      when a user logs in, it picks up the courses/enrolment correctly - the My courses block displays the correct courses that a student is enrolled in.

      when a user who has been enrolled in a course via Ldap trys to enter one of the courses displayed in the my courses block - they get the error:

      this course is not enrollable at the moment

      this error is thrown by this in courseenrol.php:

      if (!$course->enrollable //

      ($course->enrollable == 2 && $course->enrolstartdate > 0 && $course->enrolstartdate > time()) //

      ($course->enrollable == 2 && $course->enrolenddate > 0 && $course->enrolenddate <= time())

      )

      { print_header_simple(); notice(get_string('notenrollable'), $CFG->wwwroot); }

      I think this line in course/enrol.php is supposed to check to see if a student is already enrolled:

      if ( !empty($USER->student[$course->id]) or !empty($USER->teacher[$course->id]) ) {

      and I'm guessing this is supposed to return the relevant information:

      if (method_exists($enrol, 'get_student_courses')) {

      $enrol->get_student_courses($USER);

      I've added the following lines:

      if (method_exists($enrol, 'get_student_courses')) {

      $enrol->get_student_courses($USER);

      echo enrol:;

      print_object($p);

      echo user:;

      print_object($USER->student);

      which returns:

      enrol:manual

      Array

      (

      [1] => 1

      [153] => ldap

      [10] => ldap

      )

      Array

      (

      [1] => 1

      )

      enrol:ldap

      Array

      (

      [1] => 1

      )

      Array

      (

      [1] => 1

      )

      so when

      if ( !empty($USER->student[$course->id]) or !empty($USER->teacher[$course->id]) ) {

      is called,

      $USER->student is set to:

      Array

      (

      [1] => 1

      )

      which will fail - because the course I'm trying to gain access to has an ID of 153

      hopefully that makes sense! - bounce me on icq or google chat if you need more info!

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: