By adding a data structure to $CFG->custommenuitems (on /admin/settings.php?section=themesettings), admins are able to add items to Moodle's custom menu.
These menu items are shown to all users, but there is already the possibility to only show a menu item based on the user's language and thus create some kind of "if-clause" for showing a menu item.
I would like to propose to go one step further and give the admin the ability to only show a custom menu item if the user meets a given criteria for his user profile fields.
Example use case:
- There is a profile field courseofstudies which contains the course of studies of a user.
- There is a custom menu which points the user to information courses, timetables or other information which are specific to a certain course of studies.
- The admin who creates the custom menu in Moodle adds another criteria like to certain menu items to control that they are only shown to users of a certain course of studies.
Some third party themes which are available in the plugin repository implement a similar feature, but we would appreciate to have this feature in Moodle core.
It has to be noted that the criteria which will be added to the custom menu can't cover all types of checking a profile field. I think we should think about these checks:
- Checking that a profilefield equals a certain value
- Checking that a profilefield does not equal a certain value
- (Optionally) Checking that a profilefield contains a certain value
- (Optionally) Checking that a profilefield does not contain a certain value
- Combining two or more checks with OR is implicitly possible by adding to subsequent custom menu items to the custom menu, each with its own single check
- Combining two or more checks with AND is not possible
- Nesting two or more checks in one check clause is not possible