File size: 1.26Kb
<?php
/**
* @package XenCentral Feedback System
* @author DNF Technology
* @copyright Drnoyan & Nalyan LDA, Portugal, EU
* @license http://dnf.technology/terms/
* @link http://customers.dnf.technology
* @version 2.0.0 Beta 10
* @revision 12
*/
namespace XenCentral\Feedback\Admin\Controller;
use XF\Admin\Controller\AbstractController;
use XF\Db\Exception;
use XF\Mvc\FormAction;
use XF\Mvc\ParameterBag;
class User extends XFCP_User
{
public function actionDelete(ParameterBag $params) {
$user = $this->assertUserExists($params->user_id);
$userWriter = \XF::em()->find('XenCentral\Feedback:FeedbackUser', [
'user_id' => $user->user_id
]);
if($userWriter) {
$this->assertCanEditUser($user);
if ($this->isPost()) {
if ($user->is_super_admin) {
if (!\XF::visitor()->authenticate($this->filter('visitor_password', 'str'))) {
return $this->error(\XF::phrase('your_existing_password_is_not_correct'));
}
}
$userWriter->delete();
\XF::repository('XenCentral\Feedback:User')->rebuildFbUsers(0, 1000000);
}
}
return parent::actionDelete($params);
}
}