Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-43700 reports: Update to the sql in the comment locallib to inclu…

…de additional name fields.
  • Loading branch information...
commit 5e9c9e0e398994d882df3988da7fcf6829201e51 1 parent 12efa52
@abgreeve abgreeve authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 comment/locallib.php
View
8 comment/locallib.php
@@ -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
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.