Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By dhineshkumar on
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
Hi, The print will not work.
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.
Yogesh
http://yogeshchaugule.com/blog
I done this job referring to
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.