Elxis CMS Forum

Support => Technical support => Topic started by: stepsdesigns on April 08, 2012, 19:31:44

Title: How to change a menu link depend on Access levels ?
Post by: stepsdesigns on April 08, 2012, 19: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 ???
Title: Re: How to change a menu link depend on Access levels ?
Post by: datahell on April 09, 2012, 14: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: [Select]
<?php 
global $my;
if (
intval($my->id) > 0) {
    echo &
#39;<a href="#">logout</a>&#39;;
} else {
    echo &
#39;<a href="#">login</a>&#39;;
}
?>

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

The same functionality for Elxis Nautilus:
Code: [Select]
<?php 
if (eFactory::getElxis()->user()->gid <> 7) {
    echo &
#39;<a href="#">logout</a>&#39;;
} else {
    echo &
#39;<a href="#">login</a>&#39;;
}
?>
Title: Re: How to change a menu link depend on Access levels ?
Post by: stepsdesigns on April 09, 2012, 22:23:23
fantastic i done that already

Code: [Select]
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 ?
Title: Re: How to change a menu link depend on Access levels ?
Post by: stepsdesigns on April 09, 2012, 22:41:42
this is the code iam using now
Code: [Select]
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
Title: Re: How to change a menu link depend on Access levels ?
Post by: datahell on April 09, 2012, 22:55:21
Open module "login" (mod_login) and you will find all related functionality ready.
Title: Re: How to change a menu link depend on Access levels ?
Post by: stepsdesigns on April 10, 2012, 02:27:41
done and finished successfully thanks datahell for your help