Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • jenny_velichkova Friend
    #169609

    Hi,
    I have a menu item (ID 54) I would like to be hidden for registered users.

    I’ve read a suggestion here:

    http://www.joomlart.com/forums/showthread.php?61182-MegaMenu-Hide-menu-item-for-logged-in-members&highlight=mega+menu+hide+menu+item

    I replaced this code from plugins/system/jat3/jat3/core/menu/base.class.php

    $this->beginMenuItem($row, $level, $pos);
    $this->genMenuItem( $row, $level, $pos);

    // show menu with menu expanded - submenus visible

    if ($this->getParam('megamenu') && $row->megaparams->get('group')) $this->genMenuItems( $row->id, $level ); //not increase level
    else if ($level < $this->getParam('endlevel')) $this->genMenuItems( $row->id, $level+1 );

    $this->endMenuItem($row, $level, $pos);
    with this one:
    $active1 = $this->genClass ($row, $level, $pos);
    $user = JFactory::getUser();
    if (!($user->id != 0 && strstr($active1, "hidden") != NULL)){
    $this->beginMenuItem($row, $level, $pos);
    $this->genMenuItem( $row, $level, $pos);

    // show menu with menu expanded - submenus visible

    if ($this->getParam('megamenu') && $row->megaparams->get('group')) $this->genMenuItems( $row->id, $level ); //not increase level
    else if ($level < $this->getParam('endlevel')) $this->genMenuItems( $row->id, $level+1 );

    $this->endMenuItem($row, $level, $pos);
    }

    Unfortunately nothing happens.
    I would like to know if I have to put my menu item somewhere in the code? How can I change the code for my menu Item with ID 54? (My template is Ja Methys, Joomla 1.5

    Thank you in advance.

    jooservices Friend
    #419497

    Hi,

    You should create 2 different menu’s such as mainmenu and mainmenu2.

    mainmenu will be loaded for unlogged in users, mainmenu2 for logged in users.

    Solution is:

    Copy the base theme block mainnav (plugins/system/jat3/base-themes/default/blocks/mainnav.php) to folder templates/TEMPLATE_NAME/blocks, then open for edit. Copy this block of code to very top of the file:
    [php]
    <?php
    $user = & JFactory::getUser();
    if ($user->get(‘guest’)) {
    //not login
    T3Parameter::_setParam (‘menutype’, ‘mainmenu’);
    } else {
    //login
    T3Parameter::_setParam (‘menutype’, ‘mainmenu2’);
    }
    ?>
    [/php]

    Thanks
    Viet Vu

Viewing 2 posts - 1 through 2 (of 2 total)

This topic contains 2 replies, has 2 voices, and was last updated by  jooservices 13 years, 1 month ago.

We moved to new unified forum. Please post all new support queries in our New Forum