function cancel() { $lastTask = JRequest::getWord('last_task'); if ($lastTask !== 'edit') { $this->redirectPath = str_replace('&view=user', '', $this->redirectPath); } parent::cancel(); }