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

Ensure profile field conditions always apply in custom reports

XMLWordPrintable

    • MOODLE_403_STABLE, MOODLE_404_STABLE
    • MOODLE_404_STABLE, MOODLE_405_STABLE
    • MDL-82809-404
    • MDL-82809-405
    • Hide

      Setup

      1. Log in as admin
      2. Navigate to Courses > Course custom fields in site administration
      3. Create a new Checkbox field:
        • Name: Secret
        • Short name: secret
        • Visible to: Teachers
      4. Create two new courses:
        • Name: Course 1; Secret: Yes (checked)
        • Name: Course 2; Secret: No (unchecked)
      5. Navigate to Users > User profile fields in site administration
      6. Create a new Checkbox field:
        • Short name: secret
        • Name: Secret
        • Who is this field visible to: Not visible
      7. Create two new users:
        • Username: user1; Secret: Yes (checked)
        • Username: user2; Secret: No (unchecked)

      Custom fields

      1. Navigate to Reports from user menu
      2. Create new report from Courses source
        • Include default setup: Yes
      3. In report editor, open Conditions
      4. Add Course > Secret condition
        • Change value to Yes and apply
      5. Confirm only Course 1 is shown in editor
      6. Navigate to Audience tab
      7. Add All users and save changes
      8. Close editor
      9. Press View report action for the report you just created
      10. Confirm only Course 1 is shown in report
      11. Log out
      12. Log in as user1
      13. Navigate to Reports from user menu
      14. View the courses report
      15. Confirm only Course 1 is shown in report

      User profile fields

      1. Navigate to Reports from user menu
      2. Create new report from Users source
        • Include default setup: Yes
      3. In report editor, open Conditions
      4. Add User > Secret condition
        • Change value to Yes and apply
      5. Confirm only User 1 is shown in editor
      6. Navigate to Audience tab
      7. Add All users and save changes
      8. Close editor
      9. Press View report action for the report you just created
      10. Confirm only User 1 is shown in report
      11. Log out
      12. Log in as user1
      13. Navigate to Reports from user menu
      14. View the users report
      15. Confirm only User 1 is shown in report
      Show
      Setup Log in as admin Navigate to Courses > Course custom fields in site administration Create a new Checkbox field: Name: Secret Short name: secret Visible to: Teachers Create two new courses: Name: Course 1; Secret: Yes (checked) Name: Course 2; Secret: No (unchecked) Navigate to Users > User profile fields in site administration Create a new Checkbox field: Short name: secret Name: Secret Who is this field visible to: Not visible Create two new users: Username: user1; Secret: Yes (checked) Username: user2; Secret: No (unchecked) Custom fields Navigate to Reports from user menu Create new report from Courses source Include default setup: Yes In report editor, open Conditions Add Course > Secret condition Change value to Yes and apply Confirm only Course 1 is shown in editor Navigate to Audience tab Add All users and save changes Close editor Press View report action for the report you just created Confirm only Course 1 is shown in report Log out Log in as user1 Navigate to Reports from user menu View the courses report Confirm only Course 1 is shown in report User profile fields Navigate to Reports from user menu Create new report from Users source Include default setup: Yes In report editor, open Conditions Add User > Secret condition Change value to Yes and apply Confirm only User 1 is shown in editor Navigate to Audience tab Add All users and save changes Close editor Press View report action for the report you just created Confirm only User 1 is shown in report Log out Log in as user1 Navigate to Reports from user menu View the users report Confirm only User 1 is shown in report
    • Hide

      Code verified against automated checks.

      Checked MDL-82809 using repository: https://github.com/paulholden/moodle

      More information about this report

      Built on: Thu 17 Oct 2024 08:49:07 AM UTC

      Show
      Code verified against automated checks. Checked MDL-82809 using repository: https://github.com/paulholden/moodle MOODLE_404_STABLE (0 errors / 0 warnings) [branch: MDL-82809-404 | CI Job ] MOODLE_405_STABLE (0 errors / 0 warnings) [branch: MDL-82809-405 | CI Job ] main (0 errors / 0 warnings) [branch: MDL-82809 | CI Job ] More information about this report Built on: Thu 17 Oct 2024 08:49:07 AM UTC
    • Show
      Launching automatic jobs for branch MDL-82809 -404 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/17030/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/57996/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/57997/ Behat (Firefox - boost) Launching automatic jobs for branch MDL-82809 -405 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/17031/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/57998/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/57999/ Behat (Firefox - boost) Launching automatic jobs for branch MDL-82809 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/17032/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/58000/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/58001/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/58002/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/58003/ App tests (stable app version) Built on: Thu Oct 17 10:25:19 AM UTC 2024

      This comes from this community discussion with explanation from Ballard Ingram as to the cause/solution:

      In my report, I created a text-input field titled "Report Role" with the value of "Student." This helps us filter out user data related to profiles that are just listed as "Student." My client advised that they see everyone, not just "student." This was because the profile field visibility was set as "User, Teachers, and Admins only." It needs to be "visible to everyone." Once I made that change, boom. It worked. The audience was able to see the report I intended them to see.

      It would appear that user profile fields that are hidden from users, when added as conditions to a report they are not applied if the user viewing the report cannot see the profile field. This behaviour is unexpected and wrong

      To also check: same behaviour with custom fields

            pholden Paul Holden
            pholden Paul Holden
            Carlos Castillo Carlos Castillo
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            11 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 28 minutes
                5h 28m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.