Skip to content

Commit

Permalink
User save profile: read data from session after form validation fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Narloch committed Jul 21, 2016
1 parent 3dd50b4 commit 56194ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/com_users/controllers/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public function save()
$userId = (int) $user->get('id');

// Get the user data.
$data = $app->input->post->get('jform', array(), 'array');
$requestData = $app->input->post->get('jform', array(), 'array');

// Force the ID to this user.
$data['id'] = $userId;
$requestData['id'] = $userId;

// Validate the posted data.
$form = $model->getForm();
Expand All @@ -114,7 +114,7 @@ public function save()
}

// Validate the posted data.
$data = $model->validate($form, $data);
$data = $model->validate($form, $requestData);

// Check for errors.
if ($data === false)
Expand All @@ -136,7 +136,7 @@ public function save()
}

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

// Redirect back to the edit screen.
$userId = (int) $app->getUserState('com_users.edit.profile.id');
Expand Down

0 comments on commit 56194ce

Please sign in to comment.