I cannot control menu items from FlexiAccess

More
14 years 7 months ago #6045 by supryin
I'm really sorry. I found the error. It was my fault.
I copied the default.php not in the mod_mainmenu directory but in the mod_mainmenu/tmpl...

Again, sorry for the abuse... :(

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #6069 by gby
My default.php is under /mod_mainmenu directory and it's not OK.

Supryin, is it OK for you, now, because i can't understand, why it's not for me.

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #6251 by vistamedia
That means your default.php file is maybe already overriden in you template directory.
Code:
templates/[your_template]/html/mod_mainmenu/default.php
Or the menu you wish to adapt isn't the mod_mainemnu. For example joomlart and rockettheme have their own menu system.
Cheers,
Emmanuel.

FLEXIcontent lead developer.
www.vistamedia.fr web agency and custom development.
www.joomla.fr co-administrator.
Please no PM for support request, use the forum for that!!!

Please Log in or Create an account to join the conversation.

More
14 years 6 months ago #6374 by gby
That's what has been done. No mistake for me.

templates/mys_exposant/html/mod_mainmenu/default.php
Code:
<?php // no direct access defined('_JEXEC') or die('Restricted access'); if ( ! defined('modMainMenuXMLCallbackDefined') ) { function modMainMenuXMLCallback(&$node, $args) { $user = &JFactory::getUser(); $menu = &JSite::getMenu(); $active = $menu->getActive(); $path = isset($active) ? array_reverse($active->tree) : null; if (($args['end']) && ($node->attributes('level') >= $args['end'])) { $children = $node->children(); foreach ($node->children() as $child) { if ($child->name() == 'ul') { $node->removeChild($child); } } } if ($node->name() == 'ul') { foreach ($node->children() as $child) { if ($child->attributes('access') > $user->get('aid', 0)) { $node->removeChild($child); } // Ajout pour droit FLEXIACCESS 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); } } // Fin Ajout pour droit FLEXIACCESS } } if (($node->name() == 'li') && isset($node->ul)) { $node->addAttribute('class', 'parent'); } if (isset($path) && (in_array($node->attributes('id'), $path) || in_array($node->attributes('rel'), $path))) { if ($node->attributes('class')) { $node->addAttribute('class', $node->attributes('class').' active'); } else { $node->addAttribute('class', 'active'); } } else { if (isset($args['children']) && !$args['children']) { $children = $node->children(); foreach ($node->children() as $child) { if ($child->name() == 'ul') { $node->removeChild($child); } } } } if (($node->name() == 'li') && ($id = $node->attributes('id'))) { if ($node->attributes('class')) { $node->addAttribute('class', $node->attributes('class').' item'.$id); } else { $node->addAttribute('class', 'item'.$id); } } if (isset($path) && $node->attributes('id') == $path[0]) { $node->addAttribute('id', 'current'); } else { $node->removeAttribute('id'); } $node->removeAttribute('rel'); $node->removeAttribute('level'); $node->removeAttribute('access'); } define('modMainMenuXMLCallbackDefined', true); } modMainMenuHelper::render($params, 'modMainMenuXMLCallback');

Could there be another point where I make a mistake?

Thanks for your help

Please Log in or Create an account to join the conversation.

More
14 years 6 months ago #6456 by vistamedia
Hi,
You didn't REPLACE the first block by the second block ^^
You ADDED the second block after the first one :)
Your file should be:
Code:
<?php // no direct access defined('_JEXEC') or die('Restricted access'); if ( ! defined('modMainMenuXMLCallbackDefined') ) { function modMainMenuXMLCallback(&$node, $args) { $user = &JFactory::getUser(); $menu = &JSite::getMenu(); $active = $menu->getActive(); $path = isset($active) ? array_reverse($active->tree) : null; if (($args['end']) && ($node->attributes('level') >= $args['end'])) { $children = $node->children(); foreach ($node->children() as $child) { if ($child->name() == 'ul') { $node->removeChild($child); } } } if ($node->name() == 'ul') { foreach ($node->children() as $child) { // Ajout pour droit FLEXIACCESS 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); } } // Fin Ajout pour droit FLEXIACCESS } } if (($node->name() == 'li') && isset($node->ul)) { $node->addAttribute('class', 'parent'); } if (isset($path) && (in_array($node->attributes('id'), $path) || in_array($node->attributes('rel'), $path))) { if ($node->attributes('class')) { $node->addAttribute('class', $node->attributes('class').' active'); } else { $node->addAttribute('class', 'active'); } } else { if (isset($args['children']) && !$args['children']) { $children = $node->children(); foreach ($node->children() as $child) { if ($child->name() == 'ul') { $node->removeChild($child); } } } } if (($node->name() == 'li') && ($id = $node->attributes('id'))) { if ($node->attributes('class')) { $node->addAttribute('class', $node->attributes('class').' item'.$id); } else { $node->addAttribute('class', 'item'.$id); } } if (isset($path) && $node->attributes('id') == $path[0]) { $node->addAttribute('id', 'current'); } else { $node->removeAttribute('id'); } $node->removeAttribute('rel'); $node->removeAttribute('level'); $node->removeAttribute('access'); } define('modMainMenuXMLCallbackDefined', true); } modMainMenuHelper::render($params, 'modMainMenuXMLCallback');

Cheers,
Emmanuel.

FLEXIcontent lead developer.
www.vistamedia.fr web agency and custom development.
www.joomla.fr co-administrator.
Please no PM for support request, use the forum for that!!!

Please Log in or Create an account to join the conversation.

More
14 years 6 months ago #6460 by gby
Hi,

OK big mistake. I fixed the file ... but i have the same result.

The menu items under ACL disappears for all ... it's crazy, i can't understand.

I removed the file default.php in the rep /modules to be sure that it read the default.php in the template and it's OK.

So what ... !!! I do not know what to do

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 1.376 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline