Skip to content

Commit

Permalink
Fix wrong data for calendar custom fields when user registration fail
Browse files Browse the repository at this point in the history
  • Loading branch information
joomdonation committed Feb 15, 2023
1 parent 23de0b1 commit 0c7530c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions components/com_users/src/Controller/RegistrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,29 @@ public function register()
}
}

/**
* We need the filtered value of calendar fields because the UTC normalisation is
* done in the filter and on output. This would apply the Timezone offset on
* reload. We set the calendar values we save to the processed date.
*/
$filteredData = $form->filter($requestData);

foreach ($form->getFieldset() as $field) {
if ($field->type === 'Calendar') {
$fieldName = $field->fieldname;

if ($field->group) {
if (isset($filteredData[$field->group][$fieldName])) {
$requestData[$field->group][$fieldName] = $filteredData[$field->group][$fieldName];
}
} else {
if (isset($filteredData[$fieldName])) {
$requestData[$fieldName] = $filteredData[$fieldName];
}
}
}
}

// Save the data in the session.
$app->setUserState('com_users.registration.data', $requestData);

Expand Down

0 comments on commit 0c7530c

Please sign in to comment.