Change this:

<?php foreach ($this->onlineList as $user) : ?>
<span><?php $onlinelist[] = $user->getLink(); ?></span>
<?php endforeach; ?>

<?php echo implode(', ', $onlinelist); ?>

To just this
<?php echo implode(', ', $this->onlinelist); ?>