Commit f1ce8072 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't disable user's existing role in change role dropdown


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 635e2075
......@@ -52,8 +52,8 @@ if ($role != 'admin') {
$roles = group_get_role_info($group->id);
$rolechange_available = false;
foreach ($roles as &$r) {
$disabled = ($r->role == $currentrole) || (!group_can_change_role($group->id, $userid, $r->role));
if (!$disabled) {
$disabled = !group_can_change_role($group->id, $userid, $r->role);
if (!$disabled && $r->role != $currentrole) {
$rolechange_available = true;
}
$r = array(
......@@ -93,9 +93,11 @@ function changerole_validate(Pieform $form, $values) {
}
function changerole_submit(Pieform $form, $values) {
global $user, $group, $SESSION;
group_change_role($group->id, $user->id, $values['role']);
$SESSION->add_ok_msg(get_string('rolechanged', 'group'));
global $user, $group, $SESSION, $currentrole;
if ($values['role'] != $currentrole) {
group_change_role($group->id, $user->id, $values['role']);
$SESSION->add_ok_msg(get_string('rolechanged', 'group'));
}
redirect('/group/members.php?id='.$group->id);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment