Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions components/com_users/Controller/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,25 @@ public function save()
$app->setUserState('com_users.edit.profile.data', null);
}

/**
* Method to cancel an edit.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function cancel()
{
// Check for request forgeries.
$this->checkToken();

// Flush the data from the session.
$this->app->setUserState('com_users.edit.profile', null);

// Redirect to user profile.
$this->setRedirect(Route::_('index.php?option=com_users&view=profile', false));
}

/**
* Function that allows child controller access to model data after the data has been saved.
*
Expand Down
13 changes: 6 additions & 7 deletions components/com_users/tmpl/profile/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</div>
<?php endif; ?>

<form id="member-profile" action="<?php echo Route::_('index.php?option=com_users&task=profile.save'); ?>" method="post" class="com-users-profile__edit-form form-validate form-horizontal well" enctype="multipart/form-data">
<form id="member-profile" action="<?php echo Route::_('index.php?option=com_users'); ?>" method="post" class="com-users-profile__edit-form form-validate form-horizontal well" enctype="multipart/form-data">
<?php // Iterate through the form fieldsets and display each one. ?>
<?php foreach ($this->form->getFieldsets() as $group => $fieldset) : ?>
<?php $fields = $this->form->getFieldset($group); ?>
Expand Down Expand Up @@ -124,14 +124,13 @@

<div class="com-users-profile__edit-submit control-group">
<div class="controls">
<button type="submit" class="btn btn-primary validate">
<span>
<?php echo Text::_('JSUBMIT'); ?>
</span>
<button type="submit" class="btn btn-primary validate" name="task" value="profile.save">
<?php echo Text::_('JSUBMIT'); ?>
</button>
<button type="submit" class="btn btn-danger" name="task" value="profile.cancel" formnovalidate>
<?php echo Text::_('JCANCEL'); ?>
</button>
<a class="btn btn-danger" href="<?php echo Route::_('index.php?option=com_users&view=profile'); ?>" title="<?php echo Text::_('JCANCEL'); ?>"><?php echo Text::_('JCANCEL'); ?></a>
<input type="hidden" name="option" value="com_users">
<input type="hidden" name="task" value="profile.save">
</div>
</div>
<?php echo HTMLHelper::_('form.token'); ?>
Expand Down