You'd have to read the user name from the database. If you have $userid and the user name is all you want, then something like:
PHP Code:
$result = $db->query_first("SELECT username
FROM " . TABLE_PREFIX . "user
WHERE userid=" . $userid
);
and the name will be in $result['username'];
private.php does a more complex query (around line 1481) to get more info about (possibly multiple) users in one query. (BTW, I don't know what the "query_slave" versions of the calls do so I don't know why query_first_slave is used in private.php).