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']}'"); } }