Users: Bug Fix - Group list now displayed in select box even when none have been assigned to the user.

This commit is contained in:
reliberate
2016-05-24 16:59:54 -06:00
parent 4a4a613902
commit 7b45a631ee

View File

@@ -559,13 +559,13 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
if ($result_count > 0) {
echo "<br />\n";
if (isset($assigned_groups)) { echo "<br />\n"; }
echo "<select name='group_uuid_name' class='formfld' style='width: auto; margin-right: 3px;'>\n";
echo " <option value=''></option>\n";
foreach($result as $field) {
if ($field['group_name'] == "superadmin" && !if_group("superadmin")) { continue; } //only show the superadmin group to other superadmins
if ($field['group_name'] == "admin" && (!if_group("superadmin") && !if_group("admin") )) { continue; } //only show the admin group to other admins
if (isset($assigned_groups) && !in_array($field["group_uuid"], $assigned_groups)) {
if ( !isset($assigned_groups) || (isset($assigned_groups) && !in_array($field["group_uuid"], $assigned_groups)) ) {
echo " <option value='".$field['group_uuid']."|".$field['group_name']."'>".$field['group_name'].(($field['domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['domain_uuid']]['domain_name'] : null)."</option>\n";
}
}