How do I get the user name of the user profile page that is being visited?
You can load a user object like this : 

$current_user = menu_get_object('user', 1);
$username = $current_user-&gt;name;


Reference of menu_get_object function.