diff --git a/user.inc.php b/user.inc.php
index cb61c93..a0fd143 100644
--- a/user.inc.php
+++ b/user.inc.php
@@ -24,6 +24,13 @@
?>
include_once('account.inc.php');
+
+//we need these for the _status_update() functions, to determine who's complete and who's isnt
+//these are called on user_save for each role, if the function exists. The functions themselves
+//shoudlnt change anything, just return the results, the user_save does the updating
+require_once('judge.inc.php');
+require_once('volunteer.inc.php');
+
function user_valid_role($role)
{
global $roles;
@@ -712,16 +719,15 @@ function user_save(&$u)
if(mysql_error() != '') return "SQLERR2: " . mysql_error();
// Save the other user data that is not stored in the users table
-
if( // if this user has an altered special awards selection, it needs to be saved
- array_key_exists('special_awards', $u) &&
- count(array_diff_assoc($u['special_awards'], $u['orig']['special_awards'])) > 0
+ array_key_exists('special_awards', $u)
){
mysql_query("DELETE FROM judges_specialaward_sel WHERE users_id = {$u['id']}");
if(count($u['special_awards']) > 0){
$query = "INSERT INTO judges_specialaward_sel (users_id, award_awards_id) VALUES (" . $u['id'] . ", ";
$query .= implode('), (' . $u['id'] . ', ', $u['special_awards']);
$query .= ")";
+ echo $query;
mysql_query($query);
}
}
@@ -765,10 +771,8 @@ function user_save(&$u)
}
}
if(mysql_error() != '') return "SQLERR4: " . mysql_error();
-
- if( // if this user has an altered selection of volunteer positions, we'll need to change that too
- array_key_exists('volunteer_positions', $u) &&
- count(array_diff_assoc($u['volunteer_positions'], $u['orig']['volunteer_positions'])) > 0
+ if( // if this user has volunteer positions, or at least, an empty array for volunteer positions...
+ array_key_exists('volunteer_positions', $u)
){
mysql_query("DELETE FROM volunteer_positions_signup WHERE users_id = {$u['id']}");
if(count($u['volunteer_positions']) > 0){
@@ -780,6 +784,17 @@ function user_save(&$u)
}
if(mysql_error() != '') return "SQLERR5: " . mysql_error();
+ foreach($new_roles as $r) {
+ $result = user_check_role_complete($u, $r);
+ if($result == 'complete'){
+ mysql_query("UPDATE user_roles SET complete='yes' WHERE roles_id='{$u['roles'][$r]['roles_id']}' AND users_id='{$u['id']}'");
+ echo mysql_error();
+ }else{
+ mysql_query("UPDATE user_roles SET complete='no' WHERE roles_id='{$u['roles'][$r]['roles_id']}' AND users_id='{$u['id']}'");
+ echo mysql_error();
+ }
+ }
+
/* Record all the data in orig that we saved so subsequent
* calls to user_save don't try to overwrite data already
* saved to the database */
@@ -1594,7 +1609,6 @@ function user_invite($username, $password, $email, $roles_id){
if($returnval == null){
// if we've gotten this far, then either the user was created successfully, or they've
// been loaded and our permission to modify them has been confirmed; we can add the role.
- //james1234
$result = user_add_role($newUser, $roletype);
if($result == 'ok'){
$returnval = user_load($newUser['id']);
diff --git a/volunteer.inc.php b/volunteer.inc.php
index 44eabc4..81b7ef9 100644
--- a/volunteer.inc.php
+++ b/volunteer.inc.php
@@ -30,9 +30,9 @@ function volunteer_status_position($u)
global $conference;
if($conferenceid === null) $conferenceid = $conference['id'];
// See if they have selected something
- $q = "SELECT * FROM volunteer_positions_signup WHERE users_id = '{$u['id']}' AND conferences_id = $conferenceid";
- $r = mysql_query($q);
- if(mysql_num_rows($r) >= 1) {
+ $sql = "SELECT * FROM volunteer_positions_signup WHERE users_id = '{$u['id']}' AND conferences_id = $conferenceid";
+ $q = mysql_query($sql);
+ if(mysql_num_rows($q) >= 1) {
return "complete";
}
return "incomplete";
@@ -40,7 +40,6 @@ function volunteer_status_position($u)
function volunteer_status_update(&$u)
{
-/*
global $config;
if( user_personal_info_status($u) == 'complete'
@@ -49,10 +48,7 @@ function volunteer_status_update(&$u)
else
$u['volunteer_complete'] = 'no';
- user_save($u);
return ($u['volunteer_complete'] == 'yes') ? 'complete' : 'incomplete';
-*/
-return 'complete';
}
?>
diff --git a/volunteer_position.php b/volunteer_position.php
index 07127ab..ae2167d 100644
--- a/volunteer_position.php
+++ b/volunteer_position.php
@@ -36,6 +36,7 @@ if(array_key_exists('embed_edit_id', $_SESSION)){
if($_GET['action']=="save"){
$vals = '';
+ print_r($_POST);
if(is_array($_POST['posn'])) {
/* Load available IDs */
@@ -51,8 +52,12 @@ if($_GET['action']=="save"){
if(!in_array($id, $posns)) continue;
$vals[] = $id;
}
+ $u['volunteer_positions'] = $vals;
}
- $u['volunteer_positions'] = $vals;
+ else {
+ //if they didnt select anything...
+ $u['volunteer_positions']=array();
+ }
user_save($u);
$newstatus = volunteer_status_position($u);
?>
@@ -152,7 +157,7 @@ while($p = mysql_fetch_object($r)) {
}
echo "