diff --git a/classes/structure.php b/classes/structure.php index 8efdf29..6d02fa1 100644 --- a/classes/structure.php +++ b/classes/structure.php @@ -755,6 +755,8 @@ class mod_attendance_structure { * @return object */ protected static function tempuser_to_user($tempuser) { + global $CFG; + $ret = (object)array( 'id' => $tempuser->studentid, 'firstname' => $tempuser->fullname, @@ -766,11 +768,17 @@ class mod_attendance_structure { 'picture' => 0, 'type' => 'temporary', ); - foreach (get_all_user_name_fields() as $namefield) { + $allfields = get_all_user_name_fields(); + if (!empty($CFG->showuseridentity)) { + $allfields = array_merge($allfields, explode(',', $CFG->showuseridentity)); + } + + foreach ($allfields as $namefield) { if (!isset($ret->$namefield)) { $ret->$namefield = ''; } } + return $ret; }