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

When hiddenuserfields contains "mycourses", a user can't see his enrolled courses on his own profile page

    XMLWordPrintable

    Details

      Description

      See https://tracker.moodle.org/browse/MDL-21394.

      Our version is Moodle 3.5.8. The problem is still present in master.

      https://github.com/moodle/moodle/blob/9f997f9bd7edc6ea0b4371804f9a78b84f866e51/lib/myprofilelib.php#L230-L233

      Configure "mycourses" as a hidden user field, login as a user without the capability "moodle/user:viewhiddendetails" and you can't see your own courses.

      Solution would just be to check for $iscurrentuser, e.g.:

          if (!isset($hiddenfields['mycourses']) || $iscurrentuser) {
              $showallcourses = optional_param('showallcourses', 0, PARAM_INT);
              if ($mycourses = enrol_get_all_users_courses($user->id, true, null)) {
                  $shown = 0;
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Nov/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 50 minutes
                50m