Hello guys,
I am using simplicity and i wonder, shouldn't the login button test change to something like "logout" after the user logs in?
$txt .= $tmpname;if(stripos($active, 'gkLogin') !== FALSE) {
$user = JFactory::getUser();
if($user->id > 0) {
$txt = JText::_('TPL_GK_LANG_MYACCOUNT');
}
}TPL_GK_LANG_MYACCOUNT="My account"dziudek wrote:Hello,
In this template this feature is not available by default, but you can implement it as we have implemented it i.e. in the University template - please open file lib/menu/GKBase.class.php and in method genMenuItem please add after line:
- Code: Select all
$txt .= $tmpname;
please add the following fragment:
- Code: Select all
if(stripos($active, 'gkLogin') !== FALSE) {
$user = JFactory::getUser();
if($user->id > 0) {
$txt = JText::_('TPL_GK_LANG_MYACCOUNT');
}
}
It will replace the text in the menu item which has CSS class "gkLogin".
Of course you have to add in the template language file the following phrase:
- Code: Select all
TPL_GK_LANG_MYACCOUNT="My account"
dziudek wrote:Please send me your modified file.
dziudek wrote:The code seems to be ok - do you have a gkLogin CSS class in this menu item?
dziudek wrote:Could you please provide me with a URL to your website and FTP access via PM (click the “Private Message” text underneath my avatar) so that I may analyze it?
dziudek wrote:Your problem is caused by fact that your log in item is not located in the mainmenu - my custom change was dedicated for main menu. In your case (log in item in custom menu) I have no solution.
$user = JFactory::getUser();
if($user->id > 0) {
// code to display for the registered users
}dziudek wrote:If you want to display some code visible for the registered users you have to wrap your code into the following code:
- Code: Select all
$user = JFactory::getUser();
if($user->id > 0) {
// code to display for the registered users
}
$user = JFactory::getUser();
if($user->id = 0) {
// code to display for the registered users
}if($user->id == 0) {if($user->id = 0) {dziudek wrote:Yes, but please use the following line for the not-logged users:
- Code: Select all
if($user->id == 0) {
condition:
- Code: Select all
if($user->id = 0) {
is always true - even if $user->id is different than 0.
