Edit a User'; $edit_uid = 0; if(array_key_exists('uid', $_POST)) { $edit_uid = (int)$_POST['uid']; } else if(array_key_exists('uid', $_GET)) { $edit_uid = (int)$_GET['uid']; } if($edit_uid == 0) exit(); $edit_u = user_load($mysqli, $edit_uid); $edit_p = NULL; if(in_array('student', $edit_u['roles'])) { $edit_p = project_load($mysqli, $edit_u['s_pid']); } $action = ''; if(array_key_exists('action', $_POST)) { $action = $_POST['action']; } switch($action) { case 'save': case 'save_back': post_text($edit_u['firstname'], 'firstname'); post_text($edit_u['lastname'], 'lastname'); post_text($edit_u['email'], 'email'); post_text($edit_u['username'], 'username'); post_bool($edit_u['attending'], 'attending'); post_text($edit_u['reg_close_override'], 'reg_close_override'); if($config['tshirt_enable']) { post_text($edit_u['tshirt'], 'tshirt'); if(!array_key_exists($edit_u['tshirt'], $tshirt_sizes)) { $edit_u['tshirt'] = NULL; } } if($config['tours_enable']) { if(in_array('student', $edit_u['roles'])) { post_int($edit_u['tour_id'], 'tour_id'); } } if($edit_u['reg_close_override'] !== NULL) { $d = date_parse($edit_u['reg_close_override']); if($d['year'] > 1900 && $d['month'] > 0 && $d['day'] > 0) { $edit_u['reg_close_override'] = sprintf("%04d-%02d-%02d 23:59:59", $d['year'], $d['month'], $d['day']); } else { $edit_u['reg_close_override'] = NULL; } } user_save($mysqli, $edit_u); if($action == 'save') { form_ajax_response(array('status'=>0)); } else { form_ajax_response(array('status'=>0, 'location'=>'back')); } exit(); case 'psave': case 'psave_back': if(in_array('student', $edit_u['roles'])) { post_int($edit_p['disqualified_from_awards'], 'disqualified_from_awards'); post_int($edit_p['number_sort'], 'number_sort'); post_int($edit_p['floor_number'], 'floor_number'); post_text($edit_p['number'], 'number'); $edit_p['unavailable_timeslots'] = array(); $timeslots = timeslots_load_all($mysqli); foreach($timeslots as $tid=>&$ts) { $a = array(); post_array($a, "unavailable_timeslots$tid"); $edit_p['unavailable_timeslots'] = array_merge($edit_p['unavailable_timeslots'] , $a); } project_save($mysqli, $edit_p); if($action == 'psave') { form_ajax_response(array('status'=>0)); } else { form_ajax_response(array('status'=>0, 'location'=>'back')); } } exit(); case 'jsave': case 'jsave_back': if(in_array('judge', $edit_u['roles'])) { /* j_avoid_project_ids may not exist in the POST, that means it's empty */ $edit_u['j_avoid_project_ids'] = array(); post_array($edit_u['j_avoid_project_ids'], 'j_avoid_project_ids'); user_save($mysqli, $edit_u); if($action == 'jsave') { form_ajax_response(array('status'=>0)); } else { form_ajax_response(array('status'=>0, 'location'=>'back')); } } exit(); case 'assign_project_number': $result = project_number_assign($mysqli, $edit_p); if($result != true) { form_ajax_response(array('status'=>1)); } else { $updates = array('number' => $edit_p['number'], 'floor_number'=>$edit_p['floor_number'], 'number_sort'=>$edit_p['number_sort']); form_ajax_response(array('status'=>0, 'val'=>$updates)); } project_save($mysqli, $edit_p); exit(); case 'delete_project_number': project_number_clear($mysqli, $edit_p); project_save($mysqli, $edit_p); $updates = array('number' => '', 'floor_number'=>'', 'number_sort'=>''); form_ajax_response(array('status'=>0, 'val'=>$updates)); exit(); case 'purge': if(in_array('student', $edit_u['roles'])) { $mysqli->real_query("DELETE FROM emergency_contacts WHERE `uid`='$edit_uid'"); /* If only one student in project, delete project too */ $q_in_project = $mysqli->query("SELECT uid FROM users WHERE `s_pid`='{$edit_u['s_pid']}'"); if($q_in_project->num_rows == 1) { $mysqli->real_query("DELETE FROM projects WHERE pid='{$edit_u['s_pid']}'"); $mysqli->real_query("DELETE FROM mentors WHERE pid='{$edit_u['s_pid']}'"); } $mysqli->real_query("DELETE FROM signatures WHERE `uid`='$edit_uid'"); } /* Do this for all users, doesn't matter if it's a student or not */ $mysqli->real_query("DELETE FROM partner_requests WHERE to_uid='$edit_uid' OR from_uid='$edit_uid'"); /* Purge the user */ $mysqli->real_query("DELETE FROM users WHERE uid='$edit_uid'"); form_ajax_response(0); exit(); case 'del': $edit_u['enabled'] = 0; user_save($mysqli, $edit_u); form_ajax_response(0); exit(); case 'resend': /* Note: also scrambles their password */ email_send_welcome_email($mysqli, $edit_u); form_ajax_response(0); exit(); case 'change_pw': $pw1 = $_POST['pw1']; $pw2 = $_POST['pw2']; if($pw1 != $pw2) { form_ajax_response_error(1, 'Passwords don\'t match'); exit(); } user_change_password($mysqli, $edit_u, $pw1); form_ajax_response(0); exit(); case 'sig_del': $key = $mysqli->real_escape_string($_POST['key']); if(strlen($key) != 32) { exit(); } $mysqli->query("DELETE FROM signatures WHERE `key`='$key'"); form_ajax_response(array('status'=>0, 'location'=>"c_user_edit.php?uid=$edit_uid")); exit(); } sfiab_page_begin($u, "Edit User", $page_id, $help); form_page_begin($page_id, array()); ?>
=$sig_name?> | =$sent?> | Waiting for Signature Signature Received |
You can specify that a judge is not allowed to judge certain projects. This works for all assignments except CUSP assignments where the judging teams are created before the CUSP projects are known. &$p) { $project_list[$pid] = $p['number'].' - '.$p['title']; } $form_id = $page_id.'_judge_form'; form_begin($form_id, 'c_user_edit.php'); form_hidden($form_id, 'uid', $edit_u['uid']); form_multiselect($form_id, 'j_avoid_project_ids[]', 'Avoid Projects', $project_list, $edit_u); form_submit($form_id, 'jsave', 'Save', 'Judge Information Saved'); form_submit($form_id, 'jsave_back', 'Save and Go Back', 'Judge Information Saved'); form_end($form_id); } ?>
Passwords must be at least 8 characters long and contain at least one letter, one number, and one non-alphanumberic character (something other than a letter and a number)
Re-send Welcome Email | Resend the initial welcome email to the user. This also re-scrambles their password. |
Change To User | Temporarily change to this user. You can also do this by pressing the gear icon beside each user on the user list page. |
Delete | This deletes the user but keeps a copy of their info to avoid breaking database links... e.g. if it's a student that won an award, the student info will still be available and linked to an award. This just means the student cannot login anymore and can never recover their password. This action can be undone if you have direct access to the database (will add SFIAB support eventually). |
Purge | Purging a user deletes all traces of them. They are deleted from winner lists, judging teams, tours, projects, everything, like they never existed. This action cannot be undone. They're gone. |