Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 2562

Joomla! 4.x Coding • Re: Get current user in Joomla 4.4.1?

$
0
0
Here is another way to present the last three lines of code. The ternary operator ? checks the user login status.

Code:

$user = $app->getSession()->get('user');echo ($user->id) ? $user->id : 'not logged in';

Statistics: Posted by toivo — Mon Jan 08, 2024 9:17 am



Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>