3

I want to create a menu item that will change dynamically its name, based on who is viewing it and his viewing access.

To make it more specific, I have created an application in Fabrik.
There are Courses and Members that are following these courses.

There are also Courses Moderators, who can view only the members of the courses they moderate.

I have a menu item to display the list of members for each course. Now it is named "Courses Members". But since for each moderator is going to display only members of his course, I would like the menu item to display the Course Name, e.g. "Yoga Members".

As an extra information, there are also corresponding usergroups for each Course, and the moderators are part of these groups as well.

At some point in the past, I think I had came across a plugin that would allow to use placeholders in the menu items name... but I can't find it and also not sure if it could work in my scenario.

Has anyone done something like this? Any plugins or other ideas please...

1
  • I'm still trying to understand what you're trying to do. You can create acl groups and set menu item visibility based on the group a user is in. Are you trying to do more than that? On a side note, you should really check out using moodle and the joomdle bridge together. It is really flexible as an online learning system.
    – Brian Peat
    Jun 12, 2014 at 1:28

4 Answers 4

2

You have to create a mod_menu override, and add the code to custom adding this special menu items.

Some templates allow to include a module position in a menu item (E.g. login) to include mod_login. But in your case, you need to inject a whole set of items. It's better to create a mod_menu customization.

1
  • sounds good - furthemore a complete clone of the module with a custom helper might be even better. Since the current project has other priorities at this phase, I should look at this option at a later time.
    – FFrewin
    Jun 13, 2014 at 13:16
1

I have achieved something like this by using NoNumbers Advanced Module Manager.

This will allow you to use PHP to "get the logged in user ID" and only show appropriate menu modules for that user. AMM has a PHP block which is what I used.

Unfortunately this needed a menu for each user so was something of a clunky workaround and not very scalable.

I think the plugin you might be looking for is also from NoNumbers called Snippets but you may have more luck in this case with ReReplacer.

1
  • I will have a look at these plugins.
    – FFrewin
    Jun 13, 2014 at 13:12
1

The way I have done this previously is to use a menu system that allows modules to be inserted (e.g. RokNavMenu) and then use Regular Labs Sourcerer in the module to query the database and display the appropriate menu items.

This may not be the most efficient method but seems to work fine and is fairly easy to do.

The longest task was to style the menu items the same as the existing styling in the menu.

In this particular case, the Tour Operator only has to update the tours and the menu is built dynamically based on what tours are entered.

You can see the end result with the "Day Tours" module extracting all the active Day Tours from the database and building the links. There are similar modules for Overnight Trips and Extended Tours etc.

Dynamic menu using RokNavMenu and modules

0

I have done this a few ways, the easiest way I found which involved no coding whatsoever was using the built in Joomla permissions. As long as you have different user groups for each class, you can create a different menu item for each type called Yoga Members, Kickboxing Members, etc., and just set the permissions on each to only display for that specific user group, so people belonging to the Yoga class user group only see the Yoga Members menu item.

This doesn't work if the situation you need the dynamic menu items for isn't able to use those user groups, but for something like membership in classes it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.