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

External services does not support gravatar profile image URLS

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0
    • 2.8, 2.9
    • Web Services
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MOODLE_30_STABLE
    • MDL-49823-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 forum activity, start a discussions which each user
      5. Create a Token for the user with the profile image:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client.
        • You need to replace the wstoken and the URL of your moodle instance

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

      7. Confirm that you receive the site information and the field containing the user picture points correctly to the user image (including the revision parameer)
      8. Now, retrieve the discussions for the forum (replace forumid with the forum instance id):

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'forumid=18&sortby=timemodified&sortdirection=DESC&page=0&perpage=20&wsfunction=mod_forum_get_forum_discussions_paginated&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true' | python -m "json.tool"

      9. Confirm that for all the discussions you see the user that started the discussion picture URl correctly, for the user that hasn't a profile image you see the URL pointing to the theme default one
      10. Now enable Gravatar images in the Moodle site
      11. Run the same CURL command, 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 forum activity, start a discussions which each user Create a Token for the user with the profile image: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client. You need to replace the wstoken and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_webservice_get_site_info&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Confirm that you receive the site information and the field containing the user picture points correctly to the user image (including the revision parameer) Now, retrieve the discussions for the forum (replace forumid with the forum instance id): curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'forumid=18&sortby=timemodified&sortdirection=DESC&page=0&perpage=20&wsfunction=mod_forum_get_forum_discussions_paginated&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true' | python -m "json.tool" Confirm that for all the discussions you see the user that started the discussion picture URl correctly, for the user that hasn't a profile image you see the URL pointing to the theme default one Now enable Gravatar images in the Moodle site Run the same CURL command, for the users without profile image you will see that the userpictureurl points now to a gravatar URL

      External functions usually creates the user profile image using

      moodle_url::make_pluginfile_url( $usercontext->id, 'user', 'icon', null, '/', 'f1');
      or
      moodle_url::make_webservice_pluginfile_url( $usercontext->id, 'user', 'icon', null, '/', 'f1');

      As mentioned in MDL-49763 the user_picture class method get_url should be used

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Jun Pataleta Jun Pataleta
            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.