public static function getUserURL($o) { $u = $o->getUser(); if ($u instanceof UserReadOnly) { return '<a href="' . URLController::get($u) . '">' . $u->getUsername() . '</a>'; } else { return 'Unknown'; } }
<div class="meta"> <?php $author = $post->getUser(); if ($author instanceof UserReadOnly) { // User exists ?> <div class="avatar"> <img src="<?php echo $author->getAvatar(); ?> " /> </div> <div class="userinfo"> <h2><a href="<?php echo URLController::get($author); ?> "> <?php echo $author->getUsername(); ?> </a></h2> <time><?php echo date('d.m.Y, H:i', $post->getDate()); ?> </time> </div> <?php } else { ?>
<div class="count"> <span><?php echo $topic->getPostsCount(); ?> </span> POSTS </div> <div class="lastPost"> <?php $lastPost = $topic->getLastPost(); if ($lastPost instanceof ForumPost) { ?> <a href="<?php echo URLController::get($lastPost); ?> "><b><?php echo $lastPost->getTopic()->getShortTitle(32); ?> </b></a> by <?php echo ThemeFunctions::getUserURL($lastPost); ?> <br /> <small class="grey"><?php echo $lastPost->getFormattedDate(); ?> </small> <?php