Martin v. Löwis
Martin v. Löwis

Reputation: 127447

Joomla conditional menu item

I'd like to create a menu item in Joomla that points to one article when the user is logged out, and a different article when the user is logged in. I tried creating two menu items, and make them conditional by setting the access level. However, with that strategy, I can only make the logged-in item appear after login; I found no way to make the other menu item go away after login.

Any suggestions?

Upvotes: 1

Views: 1433

Answers (1)

Flavio Copes
Flavio Copes

Reputation: 4359

Modify your template with this code:

<?php $user =& JFactory::getUser();  if ($user->guest) : ?>
   <jdoc:include type="modules" name="menu-guest" style="xhtml" />
<?php else : ?>
   <jdoc:include type="modules" name="menu-registered" style="xhtml" />
<?php endif; ?>

Now set two different menus and 2 different menu modules and point them to the correct position: menu-registered and menu-guest.

Upvotes: 3

Related Questions