Newbie: How to Display "Welcome {username}" in header?

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
Locked
cbryant
Registered User
Posts: 1
Joined: Sun Jul 26, 2009 10:30 pm

Newbie: How to Display "Welcome {username}" in header?

Post by cbryant »

Hi there,

I would like to be able to display a simple line of text at the very top of my forum header that says
"Welcome [username]"

But I cannot figure out how to get the logged in user's name to display.

Currently I have this code in my overall-header.html

Code: Select all

<!-- IF S_USER_LOGGED_IN -->Welcome... <!-- ENDIF -->
I can see from the rest of the overall-header.html file that phpBB is able to get and display certain bits of session information using tags that look like this:

{PRIVATE_MESSAGE_INFO}
{L_PROFILE}
{L_INDEX}

There must be an equivalent {tag} that will somehow pull the session user's name?

If I had that tag, I'm thinking that I should just be able to insert it - something like this:

Code: Select all

<!-- IF S_USER_LOGGED_IN -->Welcome {users name}<!-- ENDIF --> ?

Does anyone know if this is possible to do this way?
If so, do you know what the tag is that will show the session user's name?

Thank you very much in advance.

Chris
User avatar
Sam
Former Team Member
Posts: 2082
Joined: Thu Jan 22, 2009 3:59 am
Location: Sacramento, CA
Name: Sam Thompson
Contact:

Re: Newbie: How to Display "Welcome {username}" in header?

Post by Sam »

Code: Select all

<!-- IF S_USER_LOGGED_IN -->Welcome back {S_USERNAME}!<!-- ELSE -->Welcome Guest, how about taking a minute to <a href="{U_REGISTER}">register</a> today?<!-- ENDIF -->
You can put whatever you want there, but you get the picture :D

If you go into root/includes/functions.php, check around line 3735, under the page_header() function, you should see a huge array of possible template variables you can use.

Anything starting with "U_" is a link with an appended SID (you need to append_sid() every link around your website in which you want to Integrate sessions with), "S_" indicates session data (data about the current user), and "T_" indicates the theme links. If you see "L_" it means it is stored in the language files.

Didn't mean it to be too long winded but when I first figured this out, I wished someone would have told me. :D
Locked

Return to “[3.0.x] MOD Requests”