Solved using:
function getUserName()
{
global $AUTH_USER, $USER;
$AUTH_USER = $USER->username;
return $AUTH_USER;
}
General developer forum
Using Moodle Sessions for Authentication
This discussion has been locked so you can no longer reply to it.