Added teacher abillity to add/remove students

Updated the user_save to output more meaningful errors
Updates on 'questions' and 'pagetext' tables to change the 0 conference ID to -1, matching the -1 year
This commit is contained in:
jacob
2010-11-29 22:54:12 +00:00
parent 1e1fa0097a
commit 39f53e4168
6 changed files with 365 additions and 19 deletions

View File

@@ -653,7 +653,6 @@ function user_save(&$u)
$fields_for_role['sponsor'] = array('sponsors_id','primary','position');
$fields_for_role['teacher'] = array();
$fields_for_role['volunteer'] = array('languages');
/* Merge fields as necessary, build a big list of fields to save */
foreach($new_roles as $r) {
if(!array_key_exists($r, $fields_for_role)) continue;
@@ -1001,6 +1000,9 @@ function user_add_role(&$u, $role, $password = null){
$_SESSION['roles'][] = $role;
}
// also, update the user:
$u = user_load($u['id']);
}
return $result;
}
@@ -1507,11 +1509,7 @@ function user_invite($username, $password, $email, $roles_id){
// all fields have been passed in, let's go ahead and create the account/user/role
$newAccount = account_create($username, $password);
if(!is_array($newAccount)){
switch($newAccount){
case -1: $returnval = "Invalid username"; break;
case -2: $returnval = "Username already in use"; break;
case -3: $returnval = "Invalid password"; break;
}
$returnval = $newAccount;
}
}