function renderReplies($id)
{
    require 'config.php';
    $sql = "SELECT * FROM `comments` WHERE parent = " . $id;
    $result = mysqli_query($con, $sql);
    echo "<div class=\"reply\">";
    while ($row = mysqli_fetch_array($result)) {
        ?>
<div class="heading"><a href="viewuser.php?id=<?php 
        echo $row['userid'];
        ?>
"><?php 
        echo getUserFullName($row['userid']);
        ?>
</a> - <small><?php 
        echo $row['timestamp'];
        ?>
</small></div><small><a data-toggle="modal" data-id="<?php 
        echo $row['commentid'];
        ?>
" data-target="#comment" class="writereply"><span class="glyphicon glyphicon-plus-sign"></span></a></small>
        <div class="commenttext">
        <?php 
        echo $row['comment'];
        ?>
        </div>
        <?php 
        if (commentHasReplies($row['commentid'])) {
            renderReplies($row['commentid']);
        }
    }
    echo "</div>";
}
    echo $row['userid'];
    ?>
"><?php 
    echo getUserFullName($row['userid']) . "</a> - <small>" . $row['timestamp'];
    ?>
</small></div><small><a data-toggle="modal" data-id="<?php 
    echo $row['commentid'];
    ?>
" data-target="#comment" class="writereply"><span class="glyphicon glyphicon-plus-sign"></span></a></small>
                    <div class="commenttext">
                        <?php 
    echo $row['comment'];
    ?>
                    </div>
                    <?php 
    renderReplies($row['commentid']);
    ?>
                </div>
                
                
                <?php 
}
?>
            </div>
        </div>
        </div>
        <?php 
if (UserCan('edit_other_tasks') || $_SESSION['userid'] === getTaskInfobyID($_GET['id'], 'userid')) {
    ?>
        <div class="tab-pane" id="edittask">
            <form role="form" method="POST">