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

Create a web service function that enrols a user in a course, without knowing the id of the user, or the contextid of the course

    Details

    • Affected Branches:
      MOODLE_20_STABLE

      Description

      As an external service, I want to enrol users in courses. But I don't know the id of the user, or the contextid of the course.

      Solution: expose something like the following:

      enrol_user(array $user, array $course, array $role)

      For example, any of the following should work:

      enrol_user(array('username'  => 'chrisf') , 
                 array('shortname' => 'PHP 101'),
                 array('shortname' => 'student')
      );
      
      enrol_user(array('idnumber'  => '0123456'), 
                 array('idnumber'  => '2010-2012-PHP101'), 
                 array('id'        => '3')
      );
      
      enrol_user(array('email'     => 'chrisf@example.com'),
                 array('fullname'  => 'Introduction to PHP programming'),
                 array('name'      => 'Student')
      );
      

      Looks a bit like MDL-26250 and MDL-26251

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated: