Skip to content

Commit

Permalink
MDL-65042 rating: Fix incorrect image generated for user in rating
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva committed Aug 16, 2019
1 parent 8e9e9a5 commit a927fcd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions rating/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,20 @@ public static function get_item_ratings($contextlevel, $instanceid, $component,
$rating->rating = $maxrating;
}

// The rating object has all the required fields for generating the picture url.
$userpicture = new user_picture($rating);
$userpicture->size = 1; // Size f1.
$profileimageurl = $userpicture->get_url($PAGE)->out(false);

$result = array();
$result['id'] = $rating->id;
$result['userid'] = $rating->userid;
$result['userpictureurl'] = $profileimageurl;
$result['userfullname'] = fullname($rating);
$result['rating'] = $scalemenu[$rating->rating];
$result['timemodified'] = $rating->timemodified;

// The rating object has all the required fields for generating the picture url.
// Undo the aliasing of the user id column from user_picture::fields().
$rating->id = $rating->userid;
$userpicture = new user_picture($rating);
$userpicture->size = 1; // Size f1.
$result['userpictureurl'] = $userpicture->get_url($PAGE)->out(false);

$results[] = $result;
}
}
Expand Down

0 comments on commit a927fcd

Please sign in to comment.