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

get_enrolled_users does not return gravatar profile images

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.8.9, 2.9.3
    • 2.8.8, 2.9.2, 3.0
    • Web Services
    • MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MDL-51685-master
    • Hide
      1. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      2. Create a course, enrol a couple of students.
      3. Upload a profile image for one of the users
      4. Create a Token for one of the students:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client. We'll test that the core_enrol_get_enrolled_users WS now returns the images as it should:
        • You need to replace the wstoken, courseid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_enrol_get_enrolled_users&courseid=2&wstoken=c55d18a80fe8c06754a8b9f411087458' | python -m "json.tool"

      6. Confirm that you receive the list of users and the field containing the users pictures points correctly to the right images. The user with profile image should have a profileimageurl like: http://localhost/m/stable_master/pluginfile.php/25/user/icon/clean/f1?rev=15.
      7. Now, we'll test retrieve a single user profile with core_user_get_course_user_profiles.
        • You need to replace the wstoken, courseid, userid and the URL of your moodle instance. Use the userid that has the uploaded profile image.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_user_get_course_user_profiles&userlist%5B0%5D%5Buserid%5D=4&userlist%5B0%5D%5Bcourseid%5D=2&wstoken=5b6154a56566a194f60f7f395f235179' | python -m "json.tool"

      8. Confirm that the image urls returned have the 'rev' param.
      9. Now enable Gravatar images in the Moodle site.
      10. Run the same CURL commands, for the users without profile image you will see that the userpictureurl points now to a gravatar URL.
      Show
      As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a course, enrol a couple of students. Upload a profile image for one of the users Create a Token for one of the students: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client. We'll test that the core_enrol_get_enrolled_users WS now returns the images as it should: You need to replace the wstoken, courseid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_enrol_get_enrolled_users&courseid=2&wstoken=c55d18a80fe8c06754a8b9f411087458' | python -m "json.tool" Confirm that you receive the list of users and the field containing the users pictures points correctly to the right images. The user with profile image should have a profileimageurl like: http://localhost/m/stable_master/pluginfile.php/25/user/icon/clean/f1?rev=15 . Now, we'll test retrieve a single user profile with core_user_get_course_user_profiles . You need to replace the wstoken, courseid, userid and the URL of your moodle instance. Use the userid that has the uploaded profile image. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_user_get_course_user_profiles&userlist%5B0%5D%5Buserid%5D=4&userlist%5B0%5D%5Bcourseid%5D=2&wstoken=5b6154a56566a194f60f7f395f235179' | python -m "json.tool" Confirm that the image urls returned have the 'rev' param. Now enable Gravatar images in the Moodle site. Run the same CURL commands, for the users without profile image you will see that the userpictureurl points now to a gravatar URL.

      When we fixed MDL-49823 we forgot to fix the core library that return user images

            dpalou Dani Palou
            jleyva Juan Leyva
            Jun Pataleta Jun Pataleta
            Andrew Lyons Andrew Lyons
            Rajesh Taneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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