MyBB Hacks

Full Version: HTML in $lastpost_data['lastposter']
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to add subforum info in tooltip in the forumbit_depth3 template.
This code works fine:

Code:
<li>{$statusicon} <a href="{$forum_url}" title="<if $forum_viewers_text_plain then>{$forum_viewers_text_plain}
</if>{$lang->forumbit_threads}: {$forum['threads']}
{$lang->forumbit_posts}: {$forum['posts']}<if $lastpost_data['lastposteruid'] then>
{$lang->forumbit_lastpost}: <?=htmlspecialchars_uni($lastpost_data['lastpostsubject'])?> {$lang->by} <setvar lastusername>get_user($lastpost_data['lastposteruid'])</setvar><func htmlspecialchars_uni>{$tplvars['lastusername']['username']}</func></if>">{$forum['name']}</a></li>


However, as you can see the last post username isn't made really efficient and uses unnecessary query. I had to do it like that because this code:

Code:
<li>{$statusicon} <a href="{$forum_url}" title="<if $forum_viewers_text_plain then>{$forum_viewers_text_plain}
</if>{$lang->forumbit_threads}: {$forum['threads']}
{$lang->forumbit_posts}: {$forum['posts']}<if $lastpost_data['lastposteruid'] then>
{$lang->forumbit_lastpost}: <?=htmlspecialchars_uni($lastpost_data['lastpostsubject'])?> {$lang->by} <func htmlspecialchars_uni>{$lastpost_data['lastposter']}</func></if>">{$forum['name']}</a></li>

adds usergroup HTML to name no matter if I use htmlspecialchars_uni, strip_tags or both on that variable. I'm almost sure it's caused by this (Style Usernames plugin):

PHP Code:
    public function buildForumbits(&$forum)
    {
        $this->cache['users'][$forum['lastposteruid']] = $forum['lastposter'];
        $forum['lastposter'] = "#STYLE_USERNAMES_UID{$forum['lastposteruid']}#";
    }


How would I strip HTML from the mentioned variable? Or is there any other way to get plain username using MyBB/Template Conditionals without additional query?

You can try using $fcache array.
Never mind, I found a plain username variable hooked in forum bits by Last/First Post Avatar plugin which I use. Thanks anyways.
Reference URL's