mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 09:55:33 +02:00
MDL-51685 user: Support gravatar images in user_get_user_details
This commit is contained in:
parent
4cef723c22
commit
1f7273af6a
14
user/lib.php
14
user/lib.php
@ -244,7 +244,7 @@ function user_get_default_fields() {
|
||||
* @return array|null
|
||||
*/
|
||||
function user_get_user_details($user, $course = null, array $userfields = array()) {
|
||||
global $USER, $DB, $CFG;
|
||||
global $USER, $DB, $CFG, $PAGE;
|
||||
require_once($CFG->dirroot . "/user/profile/lib.php"); // Custom field library.
|
||||
require_once($CFG->dirroot . "/lib/filelib.php"); // File handling on description and friends.
|
||||
|
||||
@ -362,12 +362,16 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
|
||||
// Profile image.
|
||||
if (in_array('profileimageurl', $userfields)) {
|
||||
$profileimageurl = moodle_url::make_pluginfile_url($usercontext->id, 'user', 'icon', null, '/', 'f1');
|
||||
$userdetails['profileimageurl'] = $profileimageurl->out(false);
|
||||
$userpicture = new user_picture($user);
|
||||
$userpicture->size = 1; // Size f1.
|
||||
$userdetails['profileimageurl'] = $userpicture->get_url($PAGE)->out(false);
|
||||
}
|
||||
if (in_array('profileimageurlsmall', $userfields)) {
|
||||
$profileimageurlsmall = moodle_url::make_pluginfile_url($usercontext->id, 'user', 'icon', null, '/', 'f2');
|
||||
$userdetails['profileimageurlsmall'] = $profileimageurlsmall->out(false);
|
||||
if (!isset($userpicture)) {
|
||||
$userpicture = new user_picture($user);
|
||||
}
|
||||
$userpicture->size = 0; // Size f2.
|
||||
$userdetails['profileimageurlsmall'] = $userpicture->get_url($PAGE)->out(false);
|
||||
}
|
||||
|
||||
// Hidden user field.
|
||||
|
Loading…
x
Reference in New Issue
Block a user