From a8e81cc84cba3ee974d4984d83b9c243cb7bca9f Mon Sep 17 00:00:00 2001 From: jacob Date: Thu, 16 Feb 2012 20:34:08 +0000 Subject: [PATCH] Updated the user delete code to delete by uid rather than id. --- user.inc.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/user.inc.php b/user.inc.php index bb2ecf3..02fa902 100644 --- a/user.inc.php +++ b/user.inc.php @@ -514,9 +514,14 @@ function user_delete_volunteer($u) function user_delete_judge($u) { global $config; - $id = $u['id']; - mysql_query("DELETE FROM judges_teams_link WHERE users_id='$id'"); - mysql_query("DELETE FROM judges_specialawards_sel WHERE users_id='$id'"); + $ids = array(); + $q = mysql_query("SELECT id FROM users WHERE uid = '{$u['uid']}'"); + while($row = mysql_fetch_assoc($q)) $ids[] = $row['id']; + if(count($ids) > 0){ + $idlist = implode(',', $ids); + mysql_query("DELETE FROM judges_teams_link WHERE users_id IN ($idlist)"); + mysql_query("DELETE FROM judges_specialawards_sel WHERE users_id IN($idlist)"); + } } function user_delete_fair($u) @@ -573,7 +578,7 @@ function user_delete($u, $type=false) if($types != '') $types .= ','; $types .= $t; } - mysql_query("UPDATE users SET types='$types' WHERE id='{$u['id']}'"); + mysql_query("UPDATE users SET types='$types' WHERE uid='{$u['uid']}'"); } else { $finish_delete = true; } @@ -586,7 +591,7 @@ function user_delete($u, $type=false) $finish_delete = true; } if($finish_delete == true) { - mysql_query("UPDATE users SET deleted='yes', deleteddatetime=NOW() WHERE id='{$u['id']}'"); + mysql_query("UPDATE users SET deleted='yes', deleteddatetime=NOW() WHERE uid='{$u['uid']}'"); } }