public function deleteAccountForm($iAccountId) { $oAccount = BxDolAccount::getInstance($iAccountId); $aAccountInfo = $oAccount ? $oAccount->getInfo() : false; if (!$aAccountInfo) { return MsgBox(_t('_sys_txt_error_account_is_not_defined')); } // check access if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = BxDolAccount::isAllowedDelete($this->_iProfileId, $aAccountInfo))) { return MsgBox($sMsg); } // check and display form $oForm = BxDolForm::getObjectInstance('sys_account', 'sys_account_settings_del_account'); if (!$oForm) { return MsgBox(_t('_sys_txt_error_occured')); } if (!$oForm->isSubmitted()) { unset($aAccountInfo['password']); } $oForm->initChecker($aAccountInfo); if (!$oForm->isSubmittedAndValid()) { return $oForm->getCode(); } // delete account $oAccount = BxDolAccount::getInstance($aAccountInfo['id']); if (!$oAccount->delete()) { return MsgBox(_t('_sys_txt_error_account_delete')); } // logout from deleted account bx_logout(); // redirect to homepage $this->_redirectAndExit('', false); }