How to add 'Welcome {username}' in blocks with Drupal 7 I am replacing a drupal 6 website by a drupal 7 one with the same content.
On that Drupal 6 website there is a block that comes visible when you're logged in. 
As  heading it shows the message 'Welcome {username}' in that block.

I'm looking for a way to do that in Drupal 7, i tried to do this with the module 'Token' but i doesn't work. What's the best way to do this?
Either in a block or in a custom module that adds a block, add the following code:

if (user_is_logged_in() == TRUE) {
    global $user;

    print "Welcome " . $user-&gt;name;
}
else {
    print "Please log in.";
}


This is more useful if you want CURRENT user information.  Possibly this as well for the user_is_logged_in function.