How can I show the logged username in the top menu of Joomla. I have the following code but don't know where to insert it.
$user =& JFactory::getUser(); echo $user->name;
The login module can display a greeting. You just have to go to Extensions > Module Manager > Login whatever you have the login module display name
First check which theme currently activated in your joomla project.
For eg If currently default theme "protostar"
in joomla 3.x activated then
Go to "\\PROJECT_FOLDER\\templates\\protostar"
.
Open index.php
file.
Put code after <div class="body">
tag start and add your code in your desire position.
Use below code.
<?php
$user =& JFactory::getUser();
echo $user->name;
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.