MyBB Community Forums

Full Version: Is there a function to get username by id?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a built in function to already do this (in admin cp) or would it be better to use simple_query.
Can't remember off the top of my head, but a query is very easy to do anyway:
$uid = $db->fetch_field($db->simple_select('users', 'uid', 'username="'.$db->escape_string($username).'"'), 'uid');
function get_user($uid)

In functions.php

Example:
$u = get_user(1);
echo $u['username'];
^ Oh crap, I read the title round the wrong way :/

Thanks for clearing that up Toungue
Oh nice Smile