Saturday, October 17, 2009

How to Assign Different Menu for Login user and unregistered user

Sometimes you need to check whether user sign-in or not. its very simple in joomla code. just you need a if else condition to check that. suppose you need to assign to different menu for frontend. before login users see a normal menu menu. but after they login they will see another menu. you can write the code in the template file and assign different menu.


$user =& JFactory::getUser();

if ($user->get('id')==0){

<jdoc:include type="modules" name="nonregister_frontmenu">

<?php }

if ($user->get('id')!=0){ ?>
<jdoc:include type="modules" name="menu">
<?php } ?>

<?php endif;