In includes/functions.php look for this:
PHP Code:
// ###################### Start getuserinfo #######################
// set $option to load other relevant information
function fetch_userinfo(&$userid, $option = 0)
This is the function that builds $bbuserinfo, it is called like this in /includes/session.php
PHP Code:
$bbuserinfo = fetch_userinfo($_COOKIE[COOKIE_PREFIX . 'userid'], iif(defined('IN_CONTROL_PANEL'), 16));
There are many calls over alot of files to the fetch_userinfo function, for the most part it will handle most of the work once you adapt it to your other user database. There will probbly be more work to be done but this is a good starting point.