Skip to content
Browse files

Include custom profile fields when setting up a user object

  • Loading branch information...
1 parent 66643c0 commit 323ccc26b6e5636c892ad2413d5528c3f3005221 ikawhero committed Oct 8, 2007
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/moodlelib.php
View
9 lib/moodlelib.php
@@ -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

0 comments on commit 323ccc2

Please sign in to comment.
Something went wrong with that request. Please try again.