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

When a teacher exports participants list, it doesn't include custom profile fields

    • MOODLE_403_STABLE, MOODLE_404_STABLE
    • MDL-83256-405
    • MDL-83256-500
    • Hide
      1. Log in as admin
      2. Navigate to Users > Accounts > User profile fields
      3. Create a new profile field of type Text input
        • Who is this field visible to: Visible to user, teachers and admins
        • Character limit: 255
      4. Navigate to Users > Permissions > User policies in site administration
      5. Under Show user identity select your profile field and save
      6. Create a user
      7. Create a course
      8. Enrol user in course as a teacher
      9. Log out
      10. Log in as teacher
      11. Navigate to course participants
      12. Select all users
      13. From With selected users select Microsoft Excel (.xlsx)
      14. Confirm downloaded file contains data from the configured profile field
      Show
      Log in as admin Navigate to Users > Accounts > User profile fields Create a new profile field of type Text input Who is this field visible to: Visible to user, teachers and admins Character limit: 255 Navigate to Users > Permissions > User policies in site administration Under Show user identity select your profile field and save Create a user Create a course Enrol user in course as a teacher Log out Log in as teacher Navigate to course participants Select all users From With selected users select Microsoft Excel (.xlsx) Confirm downloaded file contains data from the configured profile field
    • Hide

      Code verified against automated checks.

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

      More information about this report

      Built on: Thu Apr 17 16:58:36 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-83256 using repository: https://github.com/paulholden/moodle.git MOODLE_405_STABLE (0 errors / 0 warnings) [branch: MDL-83256-405 | CI Job ] MOODLE_500_STABLE (0 errors / 0 warnings) [branch: MDL-83256-500 | CI Job ] main (0 errors / 0 warnings) [branch: MDL-83256 | CI Job ] More information about this report Built on: Thu Apr 17 16:58:36 UTC 2025

      If you have created custom user fields of type Text (255 char max), "Visible to user, teachers and admins" (visible=3 in table user_info_field) and you're in a course, and export participants list :

      • if you are Administrator, user custom fields are well included in the Excel export
      • but if you are Teacher, user custom fields are NOT included in the Excel export

      This can be corrected by making a small change in /user/profile/lib.php file, in the function is_visible, under the "case PROFILE_VISIBLE_TEACHERS" part, by adding one more condition just before the "else" part :

                      }
                        else if (has_capability('moodle/site:viewuseridentity', $context)) {
                          return true;

      Hope this can be corrected soon.

      I don't do Moodle programmation and don't have Git repository, but it should be very simple to do.

      For french speaking people (or see how code is included), see https://moodle.org/mod/forum/discuss.php?d=461746#p1856027

            pholden Paul Holden
            fox Séverin Terrier
            Votes:
            7 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:

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