MDL-32787 user: rule required for custom profile fields applies to all users editing...
[moodle.git] / user / editadvanced_form.php
index 7092f02..dbe6d82 100644 (file)
@@ -13,16 +13,20 @@ class user_editadvanced_form extends moodleform {
         global $USER, $CFG, $COURSE;
 
         $mform =& $this->_form;
+        $editoroptions = null;
+        $filemanageroptions = null;
+        $userid = $USER->id;
 
-        if (is_array($this->_customdata) && array_key_exists('editoroptions', $this->_customdata)) {
-            $editoroptions = $this->_customdata['editoroptions'];
-        } else {
-            $editoroptions = null;
-        }
-        if (is_array($this->_customdata) && array_key_exists('filemanageroptions', $this->_customdata)) {
-            $filemanageroptions = $this->_customdata['filemanageroptions'];
-        } else {
-            $filemanageroptions = null;
+        if (is_array($this->_customdata)) {
+            if (array_key_exists('editoroptions', $this->_customdata)) {
+                $editoroptions = $this->_customdata['editoroptions'];
+            }
+            if (array_key_exists('filemanageroptions', $this->_customdata)) {
+                $filemanageroptions = $this->_customdata['filemanageroptions'];
+            }
+            if (array_key_exists('userid', $this->_customdata)) {
+                $userid = $this->_customdata['userid'];
+            }
         }
 
         //Accessibility: "Required" is bad legend text.
@@ -66,7 +70,7 @@ class user_editadvanced_form extends moodleform {
         useredit_shared_definition($mform, $editoroptions, $filemanageroptions);
 
         /// Next the customisable profile fields
-        profile_definition($mform);
+        profile_definition($mform, $userid);
 
         $this->add_action_buttons(false, get_string('updatemyprofile'));
     }