MyBB Community Forums

Full Version: [How to?] Change the color of the username in..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
well I was wondering how do I change the color the username to rep. the color of the member? [Image: 56BDS]

in the red boxes like for me I'm an admin and the reg members it would be blue... so how would I go on about to changing them to there specific colors instead of showing up like that?
http://mods.mybb.com/view/username-style

You might need to change compatibility from 14* to 16*
when I upload it, do I just upload the plugins part? or the whole "inc" folder?
Just plugin file in ./inc/plugins/ folder.

You also need to Change the compatibility and do the following edits to work it properly.;
Since many users are facing the issue that when they Install this plugin, then their Moderated By: "Some Username" becomes Moderated By: Guests

So here is how to resolve this issue;
Alright, Open plugin file and find;
function usernamestyle_build_forumbits_forum(&$forum)
{
    global $db, $mybb, $lang, $templates, $moderatorcache, $modlistsetting;
    
    // Moderator column is not off
    $mybb->settings['modlist'] = $modlistsetting;
    
    if($mybb->settings['modlist'] != 0)
    {
        $moderators = "";
        $donemoderators = array();
        $parentlist = explode(",", $forum['parentlist']);
        
        foreach($parentlist as $fid)
        {
            if(is_array($moderatorcache[$fid]))
            {
                foreach($moderatorcache[$fid] as $moderator)
                {
                    if(in_array($moderator['uid'], $donemoderators))
                    {
                        continue;
                    }
                    
                    $moderator['username'] = format_name($moderator['username'], $moderator['usergroup'], $moderator['displaygroup']);
                    $moderator['profilelink'] = build_profile_link($moderator['username'], $moderator['uid']);
                    
                    $moderators .= $comma;
                    $moderators .= $moderator['profilelink'];
                    
                    $comma = ", ";
                    
                    $donemoderators[] = $moderator['uid'];
                }
            }
        }
        
        $comma = "";
        
        if($moderators)
        {
            eval("\$forum['modlist'] = \"".$templates->get("forumbit_moderators")."\";");
        }
        else
        {
            $forum['modlist'] = "";
        }
    }
    
    // To avoid overwriting by original code segment
    $mybb->settings['modlist'] = 0;
    
    // Format lastposter name
    $query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$forum['lastposteruid']."'");
    $user = $db->fetch_array($query);
    
    $forum['lastposter'] = format_name($forum['lastposter'], $user['usergroup'], $user['displaygroup']);
} 

and Change it into the following;
function usernamestyle_build_forumbits_forum(&$forum)
{
    global $db, $mybb, $lang, $templates, $moderatorcache, $modlistsetting;
    
    // Moderator column is not off
    $mybb->settings['modlist'] = $modlistsetting;
    
    if($mybb->settings['modlist'] != 0)
    {
        $moderators = "";
        $done_moderators = array(
                    "users" => array(),
                    "groups" => array()
                );
        $parentlistexploded = explode(',', $forum['parentlist']);
        foreach($parentlistexploded as $mfid)
        {
            if(is_array($moderatorcache[$mfid]))
            {
                foreach($moderatorcache[$mfid] as $modtype)
                {
                    foreach($modtype as $moderator)
                    {
                        if($moderator['isgroup'])
                        {
                            if(in_array($moderator['id'], $done_moderators['groups']))
                            {
                                continue;
                            }
                            $moderators .= $comma.htmlspecialchars_uni($moderator['title']);
                            $done_moderators['groups'][] = $moderator['id'];
                        }
                        else
                        {
                            if(in_array($moderator['id'], $done_moderators['users']))
                            {
                                continue;
                            }
                            $moderators .= "{$comma}<a href=\"".get_profile_link($moderator['id'])."\">".format_name(htmlspecialchars_uni($moderator['username']),$moderator['usergroup'],$moderator['displaygroup'])."</a>";
                            $done_moderators['users'][] = $moderator['id'];
                        }
                        $comma = ", ";
                    }
                }
            }
        }
        $comma = "";
        
        if($moderators)
        {
            eval("\$forum['modlist'] = \"".$templates->get("forumbit_moderators")."\";");
        }
        else
        {
            $forum['modlist'] = "";
        }
    }
    
    // To avoid overwriting by original code segment
    $mybb->settings['modlist'] = 0;
    
    // Format lastposter name
    $query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$forum['lastposteruid']."'");
    $user = $db->fetch_array($query);
    
    $forum['lastposter'] = format_name($forum['lastposter'], $user['usergroup'], $user['displaygroup']);
} 

This should resolve the issue Wink
I had been wanting this the past couple of days when switching over to MyBB and I'm glad there's already a plugin for it!
Thanks, folks!
Most welcome Wink
funny thing it wouldn't let me change the plugin because it didn't give any settings or anything to it
(2011-06-01, 01:30 AM)dakillerclown87 Wrote: [ -> ]funny thing it wouldn't let me change the plugin because it didn't give any settings or anything to it

He meant make changes to the core file of the plugin, i.e "edit" this file "usernamestyle.php"
I made the changes above but it keeps saying 'This plugin is incompatible with MyBB 1609'

Anyone able to help me with this? I really want this plugin Smile.

I have since worked it out Smile.