I'm using Omega's sub-theme 'creativpink'. Currently I placed login block at header region. When user get logged in page redirects to /users/[username]. Here I want to display a welcome message on header region. I have tried using following code in my sub-themes template.php file

if (user_is_logged_in() == TRUE) {
    global $user;
    print "Welcome " . $user->name;
    }
else {
   print "Please log in.";
   }

It displays welcome message at top left but out of header region. But I want to display inside the header region at right corner. How to do this?

Comments

yogeshchaugule8’s picture

Hi,

The print will not work. You can place this code in your block and print depending on your condition. Or you can simply create a variable in your template.php in THEME_preprocess_page() and print that variable in page.tpl.php file.

dhineshkumar’s picture

I done this job referring to http://drupal.stackexchange.com/questions/21073/how-to-add-welcome-usern... link as rooby said. Thanks to for replying.