Updated the user delete code to delete by uid rather than id.

This commit is contained in:
jacob 2012-02-16 20:34:08 +00:00
parent 0e2fdc4686
commit a8e81cc84c

View File

@ -514,9 +514,14 @@ function user_delete_volunteer($u)
function user_delete_judge($u) function user_delete_judge($u)
{ {
global $config; global $config;
$id = $u['id']; $ids = array();
mysql_query("DELETE FROM judges_teams_link WHERE users_id='$id'"); $q = mysql_query("SELECT id FROM users WHERE uid = '{$u['uid']}'");
mysql_query("DELETE FROM judges_specialawards_sel WHERE users_id='$id'"); 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) function user_delete_fair($u)
@ -573,7 +578,7 @@ function user_delete($u, $type=false)
if($types != '') $types .= ','; if($types != '') $types .= ',';
$types .= $t; $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 { } else {
$finish_delete = true; $finish_delete = true;
} }
@ -586,7 +591,7 @@ function user_delete($u, $type=false)
$finish_delete = true; $finish_delete = true;
} }
if($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']}'");
} }
} }