MyBB Community Forums

Full Version: Modify variable in plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to modify plugin variable like username with my custom plugin ?!
I'm trying to create plugin to add icon next username in each place in forum but I can't know how to make it edit username in Shoutbox or TopStats plugin for example

I saw it in many forums :

[Image: 3LxBxa8.png]

this the hook :

$plugins->add_hook("global_start", "IconInTop");


and my function :

function IconInTop()
{
    global $db, $mybb, $plugins, $templatelist, $topStats;

    

        $tpl['profilelink'] = "BlaBla";
    
    
    
    return $tpl['profilelink'];
}
Modifying the formatted username is something very hard to accomplish correctly in ALL places.

Why don't you paste your icon inside the group Username Style input field? Something like:
<span title="{username}">{username} <img src="icon_url" /></span>

I'm not tryin to discourage your from coding but rather trying to figure out the best way to achieve your objective.

The following plugin code might give you some ideas too:
https://community.mybb.com/mods.php?action=view&pid=128