MDL-37628 feedback - Coding error in Recent Activity

This commit is contained in:
Andreas Grabs 2013-01-22 22:35:16 +01:00
parent b3778a0dec
commit 82e4dc33f0

View File

@ -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>';