We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Get logged in user details via php

How Do I?

Wesley's avatar
Wesley
5 posts
8 years ago
Wesley's avatar Wesley

How do I get the username of a logged in user with php in a template instead of using {logged_in_username}?

       
Neil Evans's avatar
Neil Evans
1,374 posts
8 years ago
Neil Evans's avatar Neil Evans

First off, why would you want to? If you are in the template then you can mix template tags and php quite easily!

Depending upon the why - i would look at creating a plugin or similar to do what you need. As PHP in the template is rarely needed, and it is safer to pull it out to a plugin, extension, module, etc.

N

       
Wesley's avatar
Wesley
5 posts
8 years ago
Wesley's avatar Wesley

Hi Neil,

Well originally… I was having parsing issues with {logged_in_username} as a parameter value. Therefore, the only solution I could think of was getting it with php.

However, I have no solved this thank you. I installed Mo Variables, which turns these global vars into early parsing variables. Also I now realise that low variables allows for this also.

       
Neil Evans's avatar
Neil Evans
1,374 posts
8 years ago
Neil Evans's avatar Neil Evans

Yeah, if it is a parse order issue effecting your queries then this is always handy: http://loweblog.com/downloads/ee-parse-order.pdf

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.