Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-37628 feedback - Coding error in Recent Activity

  • Loading branch information...
commit 7fdb36f523408699573e51be742b01296257f5ef 1 parent 9130843
@grabs grabs authored
Showing with 15 additions and 4 deletions.
  1. +15 −4 mod/feedback/lib.php
View
19 mod/feedback/lib.php
@@ -453,13 +453,24 @@ function feedback_get_recent_mod_activity(&$activities, &$index,
$tmpactivity->sectionnum= $cm->sectionnum;
$tmpactivity->timestamp = $feedbackitem->timemodified;
+ $tmpactivity->content = new stdClass();
$tmpactivity->content->feedbackid = $feedbackitem->id;
$tmpactivity->content->feedbackuserid = $feedbackitem->userid;
- //TODO: add all necessary user fields, this is not enough for user_picture
- $tmpactivity->user->userid = $feedbackitem->userid;
+ $userfields = explode(',', user_picture::fields());
+ $tmpactivity->user = new stdClass();
+ foreach ($userfields as $userfield) {
+ if ($userfield == 'id') {
+ $tmpactivity->user->{$userfield} = $feedbackitem->userid; // aliased in SQL above
+ } else {
+ if (!empty($feedbackitem->{$userfield})) {
+ $tmpactivity->user->{$userfield} = $feedbackitem->{$userfield};
+ } else {
+ $tmpactivity->user->{$userfield} = null;
+ }
+ }
+ }
$tmpactivity->user->fullname = fullname($feedbackitem, $viewfullnames);
- $tmpactivity->user->picture = $feedbackitem->picture;
$activities[$index++] = $tmpactivity;
}
@@ -500,7 +511,7 @@ function feedback_print_recent_mod_activity($activity, $courseid, $detail, $modn
echo '</div>';
echo '<div class="user">';
- echo "<a href=\"$CFG->wwwroot/user/view.php?id={$activity->user->userid}&amp;course=$courseid\">"
+ echo "<a href=\"$CFG->wwwroot/user/view.php?id={$activity->user->id}&amp;course=$courseid\">"
."{$activity->user->fullname}</a> - ".userdate($activity->timestamp);
echo '</div>';
Please sign in to comment.
Something went wrong with that request. Please try again.