diff --git a/include/class.user.php b/include/class.user.php index db6e7936d3a4c6c32ee9151febdb99834e80686b..4933d8f122af39a51c89f253f07f5cbd3086282c 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -163,7 +163,7 @@ class User extends UserModel { var $_entries; var $_forms; - static function fromVars($vars) { + static function fromVars($vars, $update=false) { // Try and lookup by email address $user = static::lookupByEmail($vars['email']); if (!$user) { @@ -196,6 +196,20 @@ class User extends UserModel { return null; } } + elseif ($update) { + foreach ($user->getDynamicData() as $entry) { + // FIXME: Convert this to ->form for `develop-next` + if ($entry->getForm()->type == 'U') { + $entry->setSource($vars); + $entry->save(); + } + } + // Update name + if (isset($vars['name'])) { + $user->name = $vars['name']; + $user->save(); + } + } return $user; } @@ -472,7 +486,7 @@ class User extends UserModel { foreach ($users as $u) { $vars = array_combine($keys, $u); - if (!static::fromVars($vars)) + if (!static::fromVars($vars, true)) return sprintf(__('Unable to import user: %s'), print_r($vars, true)); }