HIde some menus after login

I have a menu such as

Home || About us || Contact us || Login (before login)

and after login it became

Home || About us || Contact us || Users || Roles || Front office || logout(harry)

I want to hide some items after login like about us and contact us.So what condition should be applied to that menus.Thanks in advance.

You can set the ‘visible’ property of the CMenu item to show/hide it according to the condition.

See your /protected/views/layouts/main.php




<div id="mainmenu">

	<?php $this->widget('zii.widgets.CMenu',array(

		'items'=>array(

			array('label'=>'Home', 'url'=>array('post/index')),

			array('label'=>'About', 'url'=>array('site/page', 'view'=>'about')),

			array('label'=>'Contact', 'url'=>array('site/contact')),

			array('label'=>'Login', 'url'=>array('site/login'), 'visible'=>Yii::app()->user->isGuest),

			array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('site/logout'), 'visible'=>!Yii::app()->user->isGuest)

			....

		),

	)); ?>

</div><!-- mainmenu -->