Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-54157

Show custom menu item based on profile field values

    XMLWordPrintable

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.0.3, 3.0.4
    • None
    • MOODLE_30_STABLE

    Description

      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

        |profilefield[courseofstudies]=medicine

        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

        |profilefield[courseofstudies]=medicine

      • Checking that a profilefield does not equal a certain value

        |profilefield[courseofstudies]!=medicine

      • (Optionally) Checking that a profilefield contains a certain value

        |profilefield[courseofstudies]+=medicine

      • (Optionally) Checking that a profilefield does not contain a certain value

        |profilefield[courseofstudies]!+=medicine

      • 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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              abias Alexander Bias
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, Huong Nguyen, Bas Brands, Mathew May
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: