Elxis CMS Forum
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Bug reports and fixes
 
Pages: [1]
  Print  
Author Topic: How to change a menu link depend on Access levels ?  (Read 4687 times)
stepsdesigns
Guest
« on: April 08, 2012, 18:31:44 »

hello guys need alettel support today
how could i change 2 menu items depend on the Access level

what i need to do if the user is not loged in ( appear 2 links in the top menu which iam using mod_eisfish_menu in it " Login - Regester "

and if the user is already loged in ( appears 2 links in the top menu " Log Out - My Account "


how could i do this Huh
Logged
datahell
Elxis Team
Hero Member
*****
Offline Offline

Posts: 7601



WWW
« Reply #1 on: April 09, 2012, 13:19:44 »

You can not do this without writing some php.
Logged in users have  a $my->id greater than zero. So, you must perform this check:

Code:
<?php 
global $my;
if (
intval($my->id) > 0) {
    echo 
'<a href="#">logout</a>';
} else {
    echo 
'<a href="#">login</a>';
}
?>

Alternative to $my->id > 0 you can use the group id: $my->gid <> 29

The same functionality for Elxis Nautilus:
Code:
<?php 
if (eFactory::getElxis()->user()->gid <> 7) {
    echo 
'<a href="#">logout</a>';
} else {
    echo 
'<a href="#">login</a>';
}
?>
« Last Edit: April 09, 2012, 13:24:02 by datahell » Logged

stepsdesigns
Guest
« Reply #2 on: April 09, 2012, 21:23:23 »

fantastic i done that already

Code:
I found login link is
<a href="index.php?option=com_login">Log In</a>

and Register link is
<a href="index.php?option=com_registration&task=register">Register</a>

but i need the links for

user Profile
and log out

and my question is this links will be deference if iam using SEO Pro and if iam now ?
Logged
stepsdesigns
Guest
« Reply #3 on: April 09, 2012, 21:41:42 »

this is the code iam using now
Code:
global $my;
if (intval($my->id) > 0) {
    echo '
<ul class="login">
<li>
<a href="#">My Account</a>
</li>
<li>
<a href="index.php?option=com_login&Itemid=29">Logout</a>
</li>

</ul>';
} else {
    echo '
<ul class="login">
<li>
<a href="index.php?option=com_registration&task=register">Register</a>
</li>

<li>
<a href="index.php?option=com_login">Log In</a>
</li>

</ul>
';
}

what i need to do next
1- directly logout like the login module logout link directly without going to another page
2- find the user account link
Logged
datahell
Elxis Team
Hero Member
*****
Offline Offline

Posts: 7601



WWW
« Reply #4 on: April 09, 2012, 21:55:21 »

Open module "login" (mod_login) and you will find all related functionality ready.
Logged

stepsdesigns
Guest
« Reply #5 on: April 10, 2012, 01:27:41 »

done and finished successfully thanks datahell for your help
Logged
Pages: [1]
  Print  
 
Jump to: