forked from science-ation/science-ation
Allow the addition of a committee role to an existing user.
This commit is contained in:
parent
8b4c8297b1
commit
615c265d00
@ -92,12 +92,21 @@ echo mysql_error();
|
|||||||
if(mysql_num_rows($q)) {
|
if(mysql_num_rows($q)) {
|
||||||
$r = mysql_fetch_object($q);
|
$r = mysql_fetch_object($q);
|
||||||
if($r->deleted == 'no') {
|
if($r->deleted == 'no') {
|
||||||
echo "Username already exists.";
|
/* Load the user */
|
||||||
exit;
|
$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);
|
user_save($u);
|
||||||
$id = $u['id'];
|
$id = $u['id'];
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user