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

forum external function get_forum_discussion_posts returns incorrect userprofileurl

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 3.0.2
    • Component/s: Forum, Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a course with several students/teachers with user pictures (test users created from MDK will do).
      2. Create a forum activity and add a discussion.
      3. Login with the created accounts and post a reply to the discussion.
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the admin or any of the created users.
      6. Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. On a terminal, enter the following curl command (replace the values in square brackets accordingly).

        curl 'http://[SERVER_URL_HERE]/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=[DISCUSSION_ID_HERE]&wsfunction=mod_forum_get_forum_discussion_posts&wstoken=[TOKEN_HERE]' --compressed | python -m json.tool

      8. Choose a post from the JSON data and copy the value for userpictureurl field and open it on a browser.
        • Confirm that the displayed picture matches the user associated with the chosen post.
      9. Repeat the above step for the other forum posts.
      10. Edit user_picture::__construct() and change

        $needrec = false;
        

        to

        $needrec = true;
        

        (in or around line 218 of lib/outputcomponents.php).

      11. Run the above curl command on the terminal again.
      12. Choose a post from the JSON data and copy the value for userpictureurl field and open it on a browser.
        • Confirm that the displayed picture matches the user associated with the chosen post.
      13. Repeat the above step for the other forum posts.
      Show
      Create a course with several students/teachers with user pictures (test users created from MDK will do). Create a forum activity and add a discussion. Login with the created accounts and post a reply to the discussion. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the admin or any of the created users. Click on Site administration ► Plugins ► Web services ► Manage tokens On a terminal, enter the following curl command (replace the values in square brackets accordingly). curl 'http://[SERVER_URL_HERE]/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=[DISCUSSION_ID_HERE]&wsfunction=mod_forum_get_forum_discussion_posts&wstoken=[TOKEN_HERE]' --compressed | python -m json.tool Choose a post from the JSON data and copy the value for userpictureurl field and open it on a browser. Confirm that the displayed picture matches the user associated with the chosen post. Repeat the above step for the other forum posts. Edit user_picture::__construct() and change $needrec = false; to $needrec = true; (in or around line 218 of lib/outputcomponents.php). Run the above curl command on the terminal again. Choose a post from the JSON data and copy the value for userpictureurl field and open it on a browser. Confirm that the displayed picture matches the user associated with the chosen post. Repeat the above step for the other forum posts.
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
       MDL-52576_user_profile

      Description

      forum external function get_forum_discussion_posts returns incorrect userprofileurl
      it calls new user_picture with post id instead of user id, so never returns the right picture.

      Call external function with post replies,
      check the correct user profile url is returned

        Attachments

          Activity

            People

            Assignee:
            berserkk Ben Kelada
            Reporter:
            berserkk Ben Kelada
            Peer reviewer:
            Jun Pataleta
            Integrator:
            Dan Poltawski
            Tester:
            John Okely
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Jan/16