How can I get the UID of a user from their username?
How can I get the UID of a user from their username?
This little code will do it:
{$mybb->user['uid']}
I need a function like so:
function uid_to_username($username)
{
//find username using user id
return $uid
}
This will grab the uid if their username is correct. I'm assuming you know how to grab their username, if not just let me know and i'll edit it
global $db;
$qry = $db->query("SELECT uid FROM ".TABLE_PREFIX."users WHERE username = '".$usernamevar."'");
NP, feel free to
+rep me
Simpler way.
$user = get_user($uid);
echo $user['username']
Ah, much simpler. Thank you.
No problem.