Added code to insert user custom fields after user creation.
[timetracker.git] / user_add.php
index 83f3bbc..0cd71b0 100644 (file)
@@ -215,11 +215,7 @@ if ($request->isPost()) {
       // Insert user custom fields if we have them.
       $result = true;
       if ($user_id && $custom_fields && $custom_fields->userFields) {
-        foreach($userCustomFields as $userField) {
-          if (!$result) break;
-          $result = true; // TODO: replace this with a function call that inserts a field.
-          // Perhaps the entire block should be in the function call?
-        }
+        $result = $custom_fields->insertEntityFields(CustomFields::ENTITY_USER, $user_id, $userCustomFields);
       }
 
       if ($user_id && $result) {