Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-12-19 01:52:47
- spacewalk
- Member
- Registered: 2007-12-18
- Posts: 11
How can I get the name of the currently logged-in user?
I thought this one would be easy, but I’ve been searching for an hour with no luck. How can I get the username of the currently logged-in user? (Or user ID, or user realname, for that matter.)
Reason: I want to show the currently logged-in user a list of file downloads intended for him/her alone (the user is one of the company’s clients). I’m associating the files with the user by assigning the files a category name identical to the username.
I need to determine the logged-in user’s username so I can use it as the category attribute for the download list.
Thanks.
Offline
Re: How can I get the name of the currently logged-in user?
- In the current version 4.0.5, you would have to rely on a cookie.
- In the upcoming version 4.0.6 you’ll be able to use the more convenient is_logged_in(), which returns an array of user properties, or an accompanying plugin.
Offline
Re: How can I get the name of the currently logged-in user?
Bear in mind that in TXP 4.0.5 that cookie is only available on the admin side, not on the public side.
Offline