]> git.mjollnir.org Git - moodle.git/commitdiff
Include custom profile fields when setting up a user object
authorikawhero <ikawhero>
Mon, 8 Oct 2007 07:23:18 +0000 (07:23 +0000)
committerikawhero <ikawhero>
Mon, 8 Oct 2007 07:23:18 +0000 (07:23 +0000)
lib/moodlelib.php

index 6d7756d18fd2e721a62cb63d4dd0a8b9d423fe81..dd28800841a2749d7af283082e834e1a20a2d51e 100644 (file)
@@ -3157,6 +3157,15 @@ function get_complete_user_data($field, $value, $mnethostid=null) {
         }
     }
 
+/// Add the custom profile fields to the user record
+    include_once($CFG->dirroot.'/user/profile/lib.php');
+    $customfields = (array)profile_user_record($user->id);
+    foreach ($customfields as $cname=>$cvalue) {
+        if (!isset($user->$cname)) { // Don't overwrite any standard fields
+            $user->$cname = $cvalue;
+        }
+    }
+
 /// Rewrite some variables if necessary
     if (!empty($user->description)) {
         $user->description = true;   // No need to cart all of it around