-
AuthorPosts
-
guffas Friend
guffas
- Join date:
- April 2009
- Posts:
- 51
- Downloads:
- 2
- Uploads:
- 4
- Thanks:
- 14
- Thanked:
- 6 times in 1 posts
November 2, 2014 at 2:39 pm #202360Hi 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 Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
November 2, 2014 at 3:37 pm #553850Hi 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 Vu1 user says Thank You to jooservices for this useful post
guffas Friendguffas
- Join date:
- April 2009
- Posts:
- 51
- Downloads:
- 2
- Uploads:
- 4
- Thanks:
- 14
- Thanked:
- 6 times in 1 posts
November 2, 2014 at 5:13 pm #553853Thank 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 usersMain menu for norwegian guests
Main menu for norwegian logged in usersBTW, what file must I edit to put in your suggested code?
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
November 3, 2014 at 2:08 am #553870Hi 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 Vu1 user says Thank You to jooservices for this useful post
guffas Friendguffas
- Join date:
- April 2009
- Posts:
- 51
- Downloads:
- 2
- Uploads:
- 4
- Thanks:
- 14
- Thanked:
- 6 times in 1 posts
November 3, 2014 at 12:50 pm #553961Thank 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 Friendrotomds
- Join date:
- September 2014
- Posts:
- 13
- Downloads:
- 0
- Uploads:
- 0
- Thanks:
- 3
- Thanked:
- 1 times in 1 posts
November 3, 2014 at 2:35 pm #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 Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
November 4, 2014 at 1:39 am #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 Vu1 user says Thank You to jooservices for this useful post
guffas Friendguffas
- Join date:
- April 2009
- Posts:
- 51
- Downloads:
- 2
- Uploads:
- 4
- Thanks:
- 14
- Thanked:
- 6 times in 1 posts
November 5, 2014 at 11:27 pm #554323Thank 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 Friendguffas
- Join date:
- April 2009
- Posts:
- 51
- Downloads:
- 2
- Uploads:
- 4
- Thanks:
- 14
- Thanked:
- 6 times in 1 posts
November 6, 2014 at 12:39 am #554324Hmm….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 Friendguffas
- Join date:
- April 2009
- Posts:
- 51
- Downloads:
- 2
- Uploads:
- 4
- Thanks:
- 14
- Thanked:
- 6 times in 1 posts
November 6, 2014 at 1:15 am #554327I 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 Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
November 6, 2014 at 4:05 am #554352Hi 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 -
AuthorPosts
This topic contains 12 replies, has 3 voices, and was last updated by guffas 10 years, 1 month ago.
We moved to new unified forum. Please post all new support queries in our New Forum