-
Bug
-
Resolution: Fixed
-
Major
-
2.0.3
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
-
wip-
MDL-27676-master -
http://jerome.moodle.local/~jerome/Moodle_HEAD/pluginfile.php?file=%2F21%2Fuser%2Ficon%2Ff2 => it should return the small version of the profile image. However it is always converted to http://jerome.moodle.local/~jerome/Moodle_HEAD/theme/image.php?theme=standard&image=u%2Ff1
It should be converted to http://jerome.moodle.local/~jerome/Moodle_HEAD/theme/image.php?theme=standard&image=u%2Ff2
Note that it works perfectly if the profile is not the theme default profile image (e.g. the user uploaded his own image).
I looked very quickly at the code in pluginfile.php it's probably around there:
} else if ($component === 'user') {
|
if ($filearea === 'icon' and $context->contextlevel == CONTEXT_USER) {
|
if (!empty($CFG->forcelogin) and !isloggedin()) {
|
// protect images if login required and not logged in;
|
// do not use require_login() because it is expensive and not suitable here anyway
|
redirect($OUTPUT->pix_url('u/f1'));
|
}
|
$filename = array_pop($args);
|
if ($filename !== 'f1' and $filename !== 'f2') {
|
redirect($OUTPUT->pix_url('u/f1'));
|
}
|
if (!$file = $fs->get_file($context->id, 'user', 'icon', 0, '/', $filename.'/.png')) {
|
if (!$file = $fs->get_file($context->id, 'user', 'icon', 0, '/', $filename.'/.jpg')) {
|
redirect($OUTPUT->pix_url('u/f1'));
|
}
|
}
|
|
send_stored_file($file, 60*60*24); // enable long caching, there are many images on each page
|
|
}
|
This problem will break the display of every third party applications requesting a small picture by url, most likely mobile apps.