/** * Load the item data */ protected function loadData() { $this->id = $this->getParameter('id', 'int', null); if ($this->id == null || !BackendMailengineModel::existsUser($this->id)) { $this->redirect(BackendModel::createURLForAction('users') . '&error=non-existing'); } $this->record = BackendMailengineModel::getUser($this->id); if (substr($this->record['unsubscribe_on'], 0, 10) == '0000-00-00') { unset($this->record['unsubscribe_on']); } }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendMailengineModel::existsUser($this->id)) { parent::execute(); $this->record = (array) BackendMailengineModel::getUser($this->id); BackendMailengineModel::deleteUser($this->id); BackendMailengineModel::deleteGroupFromUser($this->id); BackendModel::triggerEvent($this->getModule(), 'after_delete_user', array('id' => $this->id)); $this->redirect(BackendModel::createURLForAction('users') . '&report=deleted&var=' . urlencode($this->record['name'])); } else { $this->redirect(BackendModel::createURLForAction('users') . '&error=non-existing'); } }