I created a module and I need to use the user name of the user's profile being viewed.
How do I call/get it?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou can load a user object like this :
$current_user = menu_get_object('user', 1);
$username = $current_user->name;
Reference of menu_get_object function.
If it's the user that's currently visiting your website that your looking to display then this code can be used.
global $user;
print $user->name;