How to display Username on Activation page

I am trying to display the user's username on the BuddyPress activate.php page when a user has successfully activated their account. I can see from using $wpdb->queries that the ID is 'known' at that point but I cannot work out the right code to get the username.