MyBB Community Forums

Full Version: Get Username from UID
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm doing a showgroups.php page.
I'm currently doing: "Leaders: Username1".

Username1's UID is 13. If Username1 changed his name, it would remain Username1 on the showgroups page. I would also like to get the username style (if he was to change his display usergroup).

{$mybb->user['13']['username']}

Huh
{$mybb->user['xxx']} is for the user currently browsing the page. You need to get username from database with $db->simple_select or w/e.

For coloring you also need to get usergroup and displaygroup from users table, the use format_name function. Like this:
$something = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
(2013-05-15, 01:20 PM)Destroy666 Wrote: [ -> ]{$mybb->user['xxx']} is for the user currently browsing the page. You need to get username from database with $db->simple_select or w/e.

For coloring you also need to get usergroup and displaygroup from users table, the use format_name function. Like this:
$something = format_name($user['username'], $user['usergroup'], $user['displaygroup']);

That's not what I'm looking for nor is that clear, sorry. Undecided
Try this and see if it works. That's the only possible formatting variable.:
$leader_colored_user = format_name($mybb->user['username'], $mybb->user['usergroup'], $mybb->user['displaygroup']);
(2013-05-15, 02:09 PM)Jimmy. Wrote: [ -> ]Try this and see if it works. That's the only possible formatting variable.:
$leader_colored_user = format_name($mybb->user['username'], $mybb->user['usergroup'], $mybb->user['displaygroup']);

Then what?
I'm still looking to do this. Smile
$user = get_user(1); // 1 = UID

$username = format_name($user['username'], $user['usergroup'], $user['displaygroup']);