This should be your plugin code. I don't know how that code is not a endless loop if you have that in global_start hook. The global file is already included so you don't need to include it again.
PHP Code:
require_once(DIR . '/includes/functions_user.php');
// setup avatar if exists
$avatar = fetch_avatar_url($vbulletin->userinfo['userid']);
if ($avatar != '' AND $vbulletin->options['avatarenabled'])
{
$avatarurl = $avatar[0];
}