XF 2.0 User link

kick

Well-known member
Code:
$link = \XF::app()->router()->buildLink('full:members', ['user_id' => $user['user_id']]);
            $user_links[] = sprintf('<a href="%s" class="username" data-user-id="%d" data-username="%s" data-xf-init="member-tooltip">%s</a>',
                $link, $user['user_id'], $user['username'], $user['username']
            );
and i call
Code:
$viewParams = [
            'users' => implode (', ', $user_links)
        ];
Result:
Code:
<a href="/index.php?members/1/" class="username" data-user-id="1" data-username="kick" data-xf-init="member-tooltip">kick</a>, <a href="/index.php?members/2/" class="username" data-user-id="2" data-username="Test" data-xf-init="member-tooltip">Test</a>
the link with plain text looks like I would not try to make it a link. On XF 1, I did so
Code:
htmlspecialchars_decode(implode (', ', $user_links))
And it worked
 
Back
Top Bottom