Welcome to Geeklog, Anonymous Monday, December 30 2024 @ 03:38 am EST
Geeklog Forums
Show username in staticpages
Grant
Anonymous
I need to show the username and users e-mail in staticpages. How do I do this. The staticpage is 'member only'. I recon its something like this:
return 'hello $user, your email is $email';
Thanks in advance.
Text Formatted Code
return 'hello $user, your email is $email';
Thanks in advance.
9
7
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The name of the current user is available through the $_USER array:
It's empty for anonymous users, though.
The email address is not stored in $_USER. You would have to get it from the database.
bye, Dirk
Text Formatted Code
return "Hello, {$_USER['username']}!";The email address is not stored in $_USER. You would have to get it from the database.
bye, Dirk
8
8
Quote
Grant
Anonymous
Thanks.
How would I get the e-mail though? I'm not really familiar with fetching MySQL information..
How would I get the e-mail though? I'm not really familiar with fetching MySQL information..
6
8
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Grant: How would I get the e-mail though?
Something like
Text Formatted Code
$email = DB_getItem ($_TABLES['users'], 'email', "uid = {$_USER['uid']}");bye, Dirk
8
7
Quote
Grant
Anonymous
Quote by Dirk:
bye, Dirk
Text Formatted Code
$email = DB_getItem ($_TABLES['users'], 'email', "uid = {$_USER['uid']}");bye, Dirk
If i put that in, and enter.. lets say
Text Formatted Code
return 'your email is £email';
its doesnt do anything but print 'your email is $email' on the page... more help please
8
8
Quote
Status: offline
inspiremin
Forum User
Regular Poster
Registered: 01/07/04
Posts: 111
Think in terms of US Dollars "$" not "£"
www.Scripturetoolkit.com www.inSPIREministries.com
www.Scripturetoolkit.com www.inSPIREministries.com
7
6
Quote
Grant
Anonymous
Thanks. Your assumtion was correct, it was a typo It works now! Silly mistake...
9
8
Quote
All times are EST. The time is now 03:38 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content