forked from science-ation/science-ation
Updated the user delete code to delete by uid rather than id.
This commit is contained in:
parent
0e2fdc4686
commit
a8e81cc84c
15
user.inc.php
15
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']}'");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user