From 861a24418893b92386910223d0141a10ec788da3 Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Wed, 24 Oct 2018 10:56:19 -0500
Subject: [PATCH] issue: Delete User Error

This addresses an issue reported on the forum where deleting a User will
throw a fatal error. This was caused by 4558 where the `state` column was
mistakenly overwritten with `event_id`. In addition, this changes `$deleted`
to `$status_id` for better readability.
---
 include/class.user.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/class.user.php b/include/class.user.php
index f2d3e2fd0..8d6bd1a7b 100644
--- a/include/class.user.php
+++ b/include/class.user.php
@@ -635,12 +635,11 @@ implements TemplateVariable, Searchable {
     }
 
     function deleteAllTickets() {
-        $event_id = Event::getIdByName('deleted');
-        $deleted = TicketStatus::lookup(array('event_id' => $event_id));
+        $status_id = TicketStatus::lookup(array('state' => 'deleted'));
         foreach($this->tickets as $ticket) {
             if (!$T = Ticket::lookup($ticket->getId()))
                 continue;
-            if (!$T->setStatus($deleted))
+            if (!$T->setStatus($status_id))
                 return false;
         }
         $this->tickets->reset();
-- 
GitLab