File size: 1.1Kb
<?php
namespace MMO\Hide\BbCode\Tag;
class HideUsersExc extends AbstractTag
{
/**
* @inheritDoc
*/
public function render($content, array $tagChildren, $tagOption, array $tag, array $options)
{
$canView = false;
$tagOptions = explode(',', $tagOption);
$matchedUsers = $this->repository('XF:User')->getUsersByNames($tagOptions, $notFound);
$user_links = [];
if (!empty($matchedUsers))
{
foreach ($matchedUsers as $user)
{
$user_links[] = $this->templater->func('username_link', [$user, true]);
if ($user->user_id != $this->visitor()->user_id)
{
$canView = true;
}
}
}
$title = \XF::phrase('mh_tag_users_exc_x', [
'users' => implode(', ', $user_links)
], true)->render('raw');
return $this->renderTemplate($content, $title, [
'canView' => $canView,
'options' => $options,
'tag' => $tag['tag']
]);
}
}