Skip to content

Commit

Permalink
MDL-43700 reports: Update to the sql in the comment locallib to inclu…
Browse files Browse the repository at this point in the history
…de additional name fields.
  • Loading branch information
abgreeve committed Jan 15, 2014
1 parent 12efa52 commit 5e9c9e0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions comment/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ function get_comments($page) {
}
$comments = array();

$sql = "SELECT c.id, c.contextid, c.itemid, c.commentarea, c.userid, c.content, u.firstname, u.lastname, c.timecreated
$usernamefields = get_all_user_name_fields(true, 'u');
$sql = "SELECT c.id, c.contextid, c.itemid, c.commentarea, c.userid, c.content, $usernamefields, c.timecreated
FROM {comments} c
JOIN {user} u
ON u.id=c.userid
Expand All @@ -74,8 +75,9 @@ function get_comments($page) {
$item->time = userdate($item->timecreated);
$item->content = format_text($item->content, FORMAT_MOODLE, $formatoptions);
// Unset fields not related to the comment
unset($item->firstname);
unset($item->lastname);
foreach (get_all_user_name_fields() as $namefield) {
unset($item->$namefield);
}
unset($item->timecreated);
// Record the comment
$comments[] = $item;
Expand Down

0 comments on commit 5e9c9e0

Please sign in to comment.