Welcome, Guest

Hiding menu item for logged in user.
(1 viewing) (1) Guest
  • Page:
  • 1


Posting guidelines
To help us help you faster please ensure that you include the following details in your forum post:
- A link to your site (you can create a support ticket if you need to provide us with confidential information.
- Please ensure that css and javascript compression is disabled in your template settings.
- Please ensure that you have checked the change log and your template and extension are up to date.
- Please search the forum to see if your answer has already been asked before.
- Please ensure that you only post your request in either the forum or ticket system but not both.
- Please only post in an existing thread if your issue is exactly the same as the one being discussed in the thread.

TOPIC: Hiding menu item for logged in user.

Hiding menu item for logged in user. 6 years ago #39

A site Ive been working on has needed a menu item to toggle according to the user state; ie if the user is not logged in then they need to see register on the menu and if they are they need to see profile at the same tab.



So I thought I would post this handy hack that I found on the Joomla forum that worked a treat.http://forum.joomla.org/index.php/topic,132047.0.html



RobInk posted something similar to the following code



<?php if( !$my->id ) mosLoadModules ( 'top' ); ?>

 <?php if( $my->id ){ mosLoadModules ( 'toolbar', -1 );}?>




So the way to apply this is to have two menus that are virtually identical and then have them published to the top and toolbar module positions.



On the menu published at the toolbar position place all of the member only links and on the top menu post all of the guest only links.



Its such a simple piece of code but I think it could be used quite powerfully on some sites.



Post edited by: Anthony, at: 2007/05/02 15:10<br><br>Post edited by: Anthony, at: 2007/05/02 15:11
  • galapados
  • OFFLINE
  • Free Extensions
  • Posts: 3
  • Karma: 0
  • Page:
  • 1
Time to create page: 0.32 seconds