Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • guffas Friend
    #202360

    Hi all

    I would like to have different main menues for different user groups in my Purity III, one for guests, and one for logged in users. Also I think about making different main menues based on different joomla usergroups, at least different default home pages

    I found this thread that suggested a hack for different menues, but that was in 2010….a long time ago. http://www.joomlart.com/forums/topic/load-a-different-mega-menu-if-user-is-logged-in/

    Is there an easyer and better way to do such tings today?

    jooservices Friend
    #553850

    Hi there


    <?php
    $user = & JFactory::getUser();
    if ($user->get('guest')) {
    //not login
    T3Parameter::_setParam ('menutype', 'pubic_menu');
    } else {
    //login
    T3Parameter::_setParam ('menutype', 'logged_in_menu');
    }
    ?>

    Code & file would be different but logical stil same 🙂 You can follow logical to do that.

    Thank you,
    Viet Vu

    guffas Friend
    #553853

    Thank you, Viet Vu. Will this solution also work for a multilingual website?

    I plan to have two languages, with two main menues, one for each language (this part is easy, as it is controlled by language switcher).

    And then also separate each of them for guest and logged in users, would this work using your suggested code?

    Main menu for english guests
    Main menu for english logged in users

    Main menu for norwegian guests
    Main menu for norwegian logged in users

    BTW, what file must I edit to put in your suggested code?

    jooservices Friend
    #553870

    Hi there,
    Please check

    templatespurity_iiitplsblocksheader.php

    with code


    <nav class="t3-navbar navbar-collapse collapse">
    <jdoc:include type="<?php echo $this->getParam('navigation_type', 'megamenu') ?>" name="<?php echo $this->getParam('mm_type', 'mainmenu') ?>" />
    </nav>

    Thank you,
    Viet Vu

    guffas Friend
    #553961

    Thank you Viet Vu

    Unfortunately I am not a coder, so I don’t understand how to modify the code you are quoting. I suspect you did not mean to have me find this code in header.php:

    <nav class="t3-navbar navbar-collapse collapse">
    <jdoc:include type="<?php echo $this->getParam('navigation_type', 'megamenu') ?>" name="<?php echo $this->getParam('mm_type', 'mainmenu') ?>" />
    </nav>

    And replace it with this code:

    <?php
    $user = & JFactory::getUser();
    if ($user->get('guest')) {
    //not login
    T3Parameter::_setParam ('menutype', 'pubic_menu');
    } else {
    //login
    T3Parameter::_setParam ('menutype', 'logged_in_menu');
    }
    ?>

    ?

    Could you please tell me exactly what replacement code you want me to put in?

    rotomds Friend
    #553969

    <em>@jooservices 451289 wrote:</em><blockquote>Hi there


    <?php
    $user = & JFactory::getUser();
    if ($user->get('guest')) {
    //not login
    T3Parameter::_setParam ('menutype', 'pubic_menu');
    } else {
    //login
    T3Parameter::_setParam ('menutype', 'logged_in_menu');
    }
    ?>

    Code & file would be different but logical stil same 🙂 You can follow logical to do that.

    Thank you,
    Viet Vu</blockquote>

    Thank you for your solving code

    rahidul

    jooservices Friend
    #554051


    <?php
    $user = & JFactory::getUser();

    if ($user->get('guest')) : ?>
    <!-- not logged -->
    <jdoc:include type="<?php echo $this->getParam('navigation_type', 'megamenu') ?>" name="<?php echo $this->getParam('mm_type', 'mainmenu') ?>" />

    <?php else : ?>
    <!-- logged -->
    <jdoc:include type="<?php echo $this->getParam('navigation_type', 'megamenu') ?>" name="<?php echo $this->getParam('mm_type', 'mainmenu') ?>" />

    <?php endif; ?>

    Please try with this code. You stil need to change “mainmenu” to another menu you want to use.

    Thank you,
    Viet Vu

    guffas Friend
    #554323

    Thank you Viet Vu

    How would this code look if I wanted to have 4 different menues, one for guests, and three different ones for logged in users, depending on which group they belong to, one for studentgroup1, one for studentgroup2 and one for studentgroup3?

    Would this also imply that I need to make 4 different template layouts for each menu item, so each layout can control its own assigned menu?

    ****

    Some of what is motivating me to investigate this solution, is that I need different default home pages for each group. Also I want to use different layouts for each group, so for “guests” I want to use “features-intro-2” and for the logged in usergroups I want to use different variations of “magazine” and “corporate”. The only way I see this possible is to use different menues for each group…unless there is another genious suggestion og way to solve it?

    guffas Friend
    #554324

    Hmm….I see a potential permission conflict for managers, administrators and superusers. These should be able to see what each group sees, and for this they need to see each groups menues (items). So what happens when a superadministrator get access to 4 different menues at the same time….this will probably create trouble?

    guffas Friend
    #554327

    I have modified header.php like this:

    <!-- NAVBAR MAIN -->

    <?php if ($this->getParam('navigation_collapse_enable')) : ?>

    <nav class="t3-navbar-collapse navbar-collapse collapse"></nav>

    <?php endif ?>

    <nav class="t3-navbar navbar-collapse collapse">

    <?php
    $user = & JFactory::getUser();

    if ($user->get('guest')) : ?>
    <!-- not logged -->
    <jdoc:include type="<?php echo $this->getParam('navigation_type', 'megamenu') ?>" name="<?php echo $this->getParam('mm_type', 'mainmenu') ?>" />

    <?php else : ?>
    <!-- logged -->
    <jdoc:include type="<?php echo $this->getParam('navigation_type', 'megamenu') ?>" name="<?php echo $this->getParam('mm_type', 'mainmenureg') ?>" />

    <?php endif; ?>
    </nav>

    <!-- //NAVBAR MAIN -->

    Then I created another template layout, so I have one layout for guests and one for registered users. I then try to configure each of these layouts with their own menu, one have the “mainmenureg” and is assigned to the mainmenureg default homepage. The other layout have “mainmenu” and is assigned to the mainmenu default homepage. When I click save and reopen the layout, both of them has “mainmenu” active, so no matter what I do, I can not get a layout to stick with this other menu “mainmenureg”.

    On top of this, I have set the permissions in the menumodules, so “mainmenu” is set to “guests”, and “mainmenureg” is set to “registered”

    Still not working, so back to start.

    jooservices Friend
    #554352

    Hi there,
    It would be same. Just follow up logical. You can use switch to determine more options.
    If it’s so hard to do. I would suggest you to contact 3rd developer as custom work.

    Thank you,
    Viet Vu

    guffas Friend
    #554412

    Thank you 🙂

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

This topic contains 12 replies, has 3 voices, and was last updated by  guffas 9 years, 6 months ago.

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