Text Size

Recommend Print

Hide unauthorized menu items in frontend

  • Published by
    Emmanuel Danan
  • Last modified
    06 August 2012
  • Voting
    (9 votes)
  • Favourites
    Add to favourites [5 users]
  • Concerns
    Component
  • Since Version
    1.0.3
  • Up to date
    Yes
  • Profile concerned
    End user, Webdesigner

- First, you set the permissions of the menu item via FLEXIaccess

- Second , if you edit the menu item e.g. to change title, DO NOT SET -any- access level

-Third, you’ll need to override your template to hide unauthorized menu items.

Copy the file

modules/mod_mainmenu/tmpl/default.php

In

templates/your_template/html/mod_mainmenu/default.php

This file may already be in.

Edit it and find the lines:

if ($child->attributes('access') > $user->get('aid', 0)) {
$node->removeChild($child);
}

Replace it by:

if (FLEXI_ACCESS) {
if (!FAccess::checkAllItemReadAccess('com_content','read','users',$user->gmid,'menu',$child->attributes('id'))) {
$node->removeChild($child);
}
} else {
if ($child->attributes('access') > $user->get('aid', 0)) {
$node->removeChild($child);
}
}

And that’s all.

NOTE: Some template providers use specific menu systems that could require a particular adaptation. We will to do this manually

Latest Members

fanfouet1973 : 19/06/2013 14:04 fanfouet1973 : 19/06/2013 14:04
chifeng : 19/06/2013 12:04 chifeng : 19/06/2013 12:04
Trust4oC : 18/06/2013 15:57 Trust4oC : 18/06/2013 15:57
xtof38 : 18/06/2013 14:13 xtof38 : 18/06/2013 14:13
PaulMa : 18/06/2013 13:36 PaulMa : 18/06/2013 13:36
lordphoenix : 16/06/2013 21:17 lordphoenix : 16/06/2013 21:17
Yamiyo : 16/06/2013 06:19 Yamiyo : 16/06/2013 06:19
avesovum : 13/06/2013 19:59 avesovum : 13/06/2013 19:59
natwork : 13/06/2013 16:00 natwork : 13/06/2013 16:00
makeitalia : 13/06/2013 12:30 makeitalia : 13/06/2013 12:30

Online Members


Members Online: 2

Latest Comments

Latest Forum Posts

Posted by brandonking - 20/06/2013 03:56
Posted by ggppdk - 20/06/2013 02:55
Posted by chifeng - 20/06/2013 01:15
Posted by Rooney - 19/06/2013 21:34
Posted by nexteo - 19/06/2013 21:25