How do I detect when, and which user is logged in so that I can display a welcome message and make button such as "log out", "my account" available in the header of my pages?
24.10.2014 13:23
|
|
BlooMort
Name: Stanley
19.04.2014
Posts: 17
|
|
24.10.2014 13:56
|
|
admin
(Support Team) Name: Admin
05.08.2010
Posts: 25852
|
|
24.10.2014 14:18
|
|
BlooMort
Name: Stanley
19.04.2014
Posts: 17
|
|
24.10.2014 14:37
|
|
BlooMort
Name: Stanley
19.04.2014
Posts: 17
|
Aw: Welcome "Joe Bloggs" message
This is the code I have inserted into index.php <?php $user = JFactory::getUser(); $greet=""; if (!$user->guest) { $greet="Welcome $user->name"; ?> <div id="myaccount"> <?php echo $greet." "; ?> <a href="index.php/component/jshopping/user">My Account</a> <a href="index.php/component/jshopping/cart">My Cart</a> </div> <?php } else { ?> <div id="myaccount"> <a href="index.php/component/jshopping/user/login">Log in</a> </div> <?php } ?> |