Get_Account_Id($sess_id, $account_id, $bd);
    $membership = Member_Role($group_id, $account_id, $bd);
    $ch_membership = Member_Role($group_id, $member_id, $bd);
    // If the user is actually moderator or owner of the group
    if (!($membership == 'O' || $membership == 'M')) {
        $error[$num_errors++] = "You are not moderator of this group.";
        include "groups.php";
        exit;
    }
    if ($ch_membership == 'O') {
        $error[$num_errors++] = "The Owner membership may not be changed.";
        include "groups.php";
        exit;
    }
    if (!empty($_POST['modify'])) {
        Group_Change_Membership($group_id, $member_id, $_POST['membership'], $bd);
        $alert[$num_alerts++] = "Membership Changed Successfully";
        include "groups_members.php";
        exit;
    }
    $groups = List_Groups($group_id, '', '', '', 1, $bd);
    $groups[0][5] = List_Group_Member($group_id, $member_id, $bd);
} else {
    $error[$num_errors++] = "Invalid Session ID";
    include "logout.php";
    exit;
}
$result_xsl = "xsl/" . $default_xsl . "/groups_members_modify.xsl";
$smarty->assign("nrpTransform", $result_xsl);
$smarty->assign("nrpSchErrors", $error);
$smarty->assign("nrpSchAlerts", $alert);
} elseif (!empty($_GET['group_id'])) {
    $group_id = $_GET['group_id'];
}
if (Validate_Session($complete_sess_id, $_SERVER['REMOTE_ADDR'], $bd)) {
    Get_Account_Id($sess_id, $account_id, $bd);
    $membership = Member_Role($group_id, $account_id, $bd);
    // If the user is actually member of the group
    if ($membership != 'I') {
        $error[$num_errors++] = "There is no membership confirmation to be done at this group.";
        include "groups.php";
        exit;
    } else {
        if (!empty($_POST['submit_conf_yes']) || !empty($_POST['submit_conf_no'])) {
            if (!empty($_POST['submit_conf_yes'])) {
                // Make the member to become a common member of the group
                Group_Change_Membership($group_id, $account_id, 'C', $bd);
                $alert[$num_alerts++] = 'You were included in the group.';
                include "groups_enter.php";
            } else {
                // Removes the invitation
                Group_Remove_Member($group_id, $account_id, $bd);
                $alert[$num_alerts++] = 'Your invitation to the group was cancelled.';
                include "groups.php";
            }
            exit;
        } else {
            $error[$num_errors++] = "Invalid confirmation code.";
        }
        $groups = List_Groups($group_id, '', '', '', 1, $bd);
    }
    $people = List_People($account_id, '', '', '', '', $bd);