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

External services does not support gravatar profile image URLS

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8, 2.9
    • Fix Version/s: 3.0
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49823-master

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  16/Nov/15