public function execute()
{
$this->id = $this->getParameter('id', 'int');
$error = $this->getParameter('error', 'string');
$this->loadAuthenticatedUser();
// If id and error parameters are not set we'll assume the user logged in
// and has been redirected to this action by the authentication index action.
// When this is the case the user will be redirected to the index action of this module.
// An action to which he may not have any user rights.
// Redirect to the user's own profile instead to avoid unnessary words.
if ($this->id === null && $error === null && $this->authenticatedUser->getUserId()) {
$this->redirect(BackendModel::createURLForAction('Edit') . '&id=' . $this->authenticatedUser->getUserId());
}
// does the user exists
if ($this->id !== null && BackendUsersModel::exists($this->id)) {
parent::execute();
$this->record = (array) BackendUsersModel::get($this->id);
$this->loadForm();
$this->validateForm();
$this->parse();
$this->display();
} else {
$this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
}
}