mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-73822 user: fix Gravatar integration for missing user images.
This commit is contained in:
parent
d24a4ab56f
commit
4ad5dda50d
@ -2575,6 +2575,8 @@ class core_renderer extends renderer_base {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function render_user_picture(user_picture $userpicture) {
|
protected function render_user_picture(user_picture $userpicture) {
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
$user = $userpicture->user;
|
$user = $userpicture->user;
|
||||||
$canviewfullnames = has_capability('moodle/site:viewfullnames', $this->page->context);
|
$canviewfullnames = has_capability('moodle/site:viewfullnames', $this->page->context);
|
||||||
|
|
||||||
@ -2611,8 +2613,8 @@ class core_renderer extends renderer_base {
|
|||||||
$attributes['title'] = $alt;
|
$attributes['title'] = $alt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the image html output first
|
// Get the image html output first, auto generated based on initials if one isn't already set.
|
||||||
if ($user->picture == 0 && !defined('BEHAT_SITE_RUNNING')) {
|
if ($user->picture == 0 && empty($CFG->enablegravatar) && !defined('BEHAT_SITE_RUNNING')) {
|
||||||
$output = html_writer::tag('span', mb_substr($user->firstname, 0, 1) . mb_substr($user->lastname, 0, 1),
|
$output = html_writer::tag('span', mb_substr($user->firstname, 0, 1) . mb_substr($user->lastname, 0, 1),
|
||||||
['class' => 'userinitials size-' . $size]);
|
['class' => 'userinitials size-' . $size]);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user