I've been looking through the scripts and templates for hours...
How do I get the user's group color?
Like, for example, the user's name on their profile is their usergroup color.
I want to do some editing on my forum, and I can't figure out how to get the user's color, it's just their username.
I've been changing some stuff in a few of the PHP scripts and the templates, but I get nothing.
ACP > Users and Groups > Groups > {group to edit} > General tab > Username Style
$mybb->usergroup['namestyle'] will get the actual HTML, format_name($username, $usergroup) will return the formatted name.
That didn't work.
This is an example of what I'm trying to do. I made it yellow using FireBug.
Post the code you're using. This is how it's done in MyBB so it can't really not work.
For forumbit_depth2_forum_lastpost:
I tried:
<span class="smalltext">
<a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date} {$lastpost_time}<br />Last Post by: $mybb->usergroup['namestyle']{$lastpost_profilelink}</span>
and
<span class="smalltext">
<a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date} {$lastpost_time}<br />Last Post by: <span style="$mybb->usergroup['namestyle']">{$lastpost_profilelink}</span></span>
I have no idea what to do.
Can anyone help?
As format_name() is a PHP function, you need PHP to format it.
I know, I tried adding it directly to index.php
I just want to know how to get the user's formatted name. So that on the "Last Post", it display's the user's color, instead of the link color.
Like, is there a {$mybb->user['....']} or something for it?
I posted what parameters it takes, the username and the usergroup.
$formatted_name = format_name($mybb->user['username'], $mybb->user['usergroup']);
The variable will be different depending on where exactly it's being used though.