}
        //create gui_(name) and gui1_(name)
        $gui->copyGui($gui_id1[0], $gui_newName1, true);
        $gui->copyGui($gui_id2[0], $gui_newName2, true);
        $gui->copyGui($gui_id3[0], $gui_newName3, true);
        $gui->copyGui($gui_id4[0], $gui_newName4, true);
        $new_guiId1 = $admin->getGuiIdByGuiName($gui_newName1);
        $new_guiId2 = $admin->getGuiIdByGuiName($gui_newName2);
        $new_guiId3 = $admin->getGuiIdByGuiName($gui_newName3);
        $new_guiId4 = $admin->getGuiIdByGuiName($gui_newName4);
        //grant owner rights for new guis to this user only!
        $admin->delAllUsersOfGui($new_guiId1[0]);
        $admin->delAllUsersOfGui($new_guiId2[0]);
        $admin->delAllUsersOfGui($new_guiId3[0]);
        $admin->delAllUsersOfGui($new_guiId4[0]);
        $admin->insertUserAsGuiOwner($new_guiId1[0], $selected_user);
        $admin->insertUserAsGuiOwner($new_guiId2[0], $selected_user);
        $admin->insertUserAsGuiOwner($new_guiId3[0], $selected_user);
        $admin->insertUserAsGuiOwner($new_guiId4[0], $selected_user);
        // delete gui from groups
        // (gui and gui1 are associated with groups 20 and 21, new guis belong to mb_user only)
        $sql_del_from_group = "DELETE FROM gui_mb_group WHERE fkey_gui_id = \$1 OR fkey_gui_id = \$2 OR fkey_gui_id = \$3 OR fkey_gui_id = \$4";
        $v = array($new_guiId1[0], $new_guiId2[0], $new_guiId3[0], $new_guiId4[0]);
        $t = array('s', 's', 's', 's');
        $res_del_from_group = db_prep_query($sql_del_from_group, $v, $t);
    }
}
if (!isset($name) || $selected_user == 'new') {
    $name = "";
    $password = "";
    $description = "";