I want to have a place that if a user is logged into my site, I can greet them with a Hello _______ !
and of course when someone is not logged into the site, a hello guest!

Is there any previous usage of this?

Comments

cayenne’s picture

Either in a block or in the page.tpl

global $user;
print ('Hello ' . $user->name);

:)

Mudjosh’s picture

Perfect!

One more to complete what I am after..

Without using panels or blocks, can I create a section that only a guest can see.. or a registered member?

I knew how to in phpbb3 but I'm sure drupal works differently.. from what I have seen.. and I don't know enough to play around with php enough.. (I just know what code does what and copy and paste until I get my desired result mostly.. hehe.. so really I knew very little.. :P )

Any help on that?

cayenne’s picture

Well, you can use Views. Or you can use CCK Field permissions.

Why would you not want to use blocks? You could create a block and put it in the content of a page...

Finally, you could, I suppose, create a page with PHP in it that offers different content depending on the outcome of whether the $user number = 0 or not.

:)

Mudjosh’s picture

I don't want to use blocks because of how it is used. you can view my site at lifeline-ministry.com . The "hello Username" is at the top which I would like guests to see "Hello Guests" and logged in users see their username in place of "guests".

Also, when you click on the tab, I would like to have different content depending on if the user is logged in or not.. (log in / log out for example)

Mudjosh’s picture

still no ideas? :(