Skip to content

Commit

Permalink
Replace deprecated user_picture::fields()
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Nguyen committed Jan 23, 2025
1 parent f2ffa46 commit f67ec8c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,8 @@ function questionnaire_get_recent_mod_activity(&$activities, &$index, $timestart
$params['timestart'] = $timestart;
$params['questionnaireid'] = $questionnaire->id;

$ufields = user_picture::fields('u', null, 'useridagain');
$userfieldsapi = \core_user\fields::for_userpic();
$ufields = $userfieldsapi->get_sql('u', false, '', 'useridagain', false)->selects;
if (!$attempts = $DB->get_records_sql("
SELECT qr.*,
{$ufields}
Expand Down Expand Up @@ -956,7 +957,10 @@ function questionnaire_get_recent_mod_activity(&$activities, &$index, $timestart
$tmpactivity->content = new stdClass();
$tmpactivity->content->attemptid = $attempt->id;

$userfields = explode(',', user_picture::fields());
$userfieldsapi = \core_user\fields::for_userpic();
$allnamefields = $userfieldsapi->get_sql('', false, '', '', false)->selects;
$selects = str_replace(', ', ',', $allnamefields);
$userfields = explode(',', $selects);
$tmpactivity->user = new stdClass();
foreach ($userfields as $userfield) {
if ($userfield == 'id') {
Expand Down

0 comments on commit f67ec8c

Please sign in to comment.