forked from science-ation/science-ation
small mod on user save function
This commit is contained in:
parent
cf2e2eb6db
commit
a0c64963e0
17
user.inc.php
17
user.inc.php
@ -689,16 +689,10 @@ function user_save(&$u)
|
||||
array_key_exists('special_awards', $u) &&
|
||||
count(array_diff_assoc($u['special_awards'], $u['orig']['special_awards'])) > 0
|
||||
){
|
||||
$aaids = array();
|
||||
foreach($u['special_awards'] as $id => $yesno){
|
||||
if(strtolower(trim($yesno)) == 'yes'){
|
||||
$aaids[] = $id;
|
||||
}
|
||||
}
|
||||
mysql_query("DELETE FROM judges_specialaward_sel WHERE users_id = {$u['id']}");
|
||||
if(is_array($aaids)){
|
||||
if(count($u['special_awards']) > 0){
|
||||
$query = "INSERT INTO judges_specialaward_sel (users_id, award_awards_id) VALUES (" . $u['id'] . ", ";
|
||||
$query .= implode('), (' . $u['id'] . ', ', $aaids);
|
||||
$query .= implode('), (' . $u['id'] . ', ', $u['specal_awards']);
|
||||
$query .= ")";
|
||||
mysql_query($query);
|
||||
}
|
||||
@ -711,12 +705,7 @@ function user_save(&$u)
|
||||
mysql_query("DELETE FROM judges_availability WHERE users_id='{$u['id']}'");
|
||||
|
||||
$query = 'SELECT date, starttime, endtime FROM judges_timeslots WHERE id IN (';
|
||||
$ids = array();
|
||||
foreach($u['available_times'] as $id => $yesno){
|
||||
if(strtolower(trim($yesno)) == 'yes'){
|
||||
$ids[] = $id;
|
||||
}
|
||||
}
|
||||
$ids = $u['available_times'];
|
||||
$query .= implode(',', $ids) . ')';
|
||||
if(count($ids) > 0){
|
||||
$insertVals = array();
|
||||
|
Loading…
Reference in New Issue
Block a user