Allow the addition of a committee role to an existing user.

This commit is contained in:
dave 2010-02-11 22:39:15 +00:00
parent 8b4c8297b1
commit 615c265d00

View File

@ -92,12 +92,21 @@ echo mysql_error();
if(mysql_num_rows($q)) {
$r = mysql_fetch_object($q);
if($r->deleted == 'no') {
echo "Username already exists.";
exit;
/* Load the user */
$u = user_load_by_email($username);
if(in_array($type, $u['types'])) {
echo "Username already exists with role '$type'";
exit;
} else {
/* Add the role, user_create does a role_allowed check
* so we'll never add a judge/committee role to a student */
user_create($type, $username, $u);
}
}
} else {
$u = user_create($type, $username);
$u['email'] = $username;
}
$u = user_create($type, $username);
$u['email'] = $username;
user_save($u);
$id = $u['id'];
} else {