MDL-60830 core_enrol: Added email when searching users in course enrol
authorSara Arjona <sara@moodle.com>
Fri, 17 Nov 2017 13:33:55 +0000 (14:33 +0100)
committerSara Arjona <sara@moodle.com>
Wed, 22 Nov 2017 12:16:16 +0000 (13:16 +0100)
enrol/externallib.php

index 3a0c38f..8f30ad1 100644 (file)
@@ -453,7 +453,11 @@ class core_enrol_external extends external_api {
                                                $params['perpage']);
 
         $results = array();
-        $requiredfields = ['id', 'fullname', 'profileimageurl', 'profileimageurlsmall'];
+        // Add also extra user fields.
+        $requiredfields = array_merge(
+            ['id', 'fullname', 'profileimageurl', 'profileimageurlsmall'],
+            get_extra_user_fields($context)
+        );
         foreach ($users['users'] as $id => $user) {
             // Note: We pass the course here to validate that the current user can at least view user details in this course.
             // The user we are looking at is not in this course yet though - but we only fetch the minimal set of