"NOBUG rename username from comment api, it supposed to be secret"
authorDongsheng Cai <unoter@gmail.com>
Wed, 25 Aug 2010 09:11:36 +0000 (09:11 +0000)
committerDongsheng Cai <unoter@gmail.com>
Wed, 25 Aug 2010 09:11:36 +0000 (09:11 +0000)
comment/lib.php
comment/locallib.php

index f8639e2..ba2f129 100644 (file)
@@ -398,7 +398,7 @@ EOD;
         $this->page = $page;
         $params = array();
         $start = $page * $CFG->commentsperpage;
-        $ufields = user_picture::fields('u', array('username'));
+        $ufields = user_picture::fields('u');
         $sql = "SELECT $ufields, c.id AS cid, c.content AS ccontent, c.format AS cformat, c.timecreated AS ctimecreated
                   FROM {comments} c
                   JOIN {user} u ON u.id = c.userid
@@ -418,7 +418,6 @@ EOD;
             $c->format      = $u->cformat;
             $c->timecreated = $u->ctimecreated;
             $url = new moodle_url('/user/view.php', array('id'=>$u->id, 'course'=>$this->courseid));
-            $c->username = $u->username;
             $c->profileurl = $url->out();
             $c->fullname = fullname($u);
             $c->time = userdate($c->timecreated, get_string('strftimerecent', 'langconfig'));
@@ -508,7 +507,6 @@ EOD;
         if (!empty($cmt_id)) {
             $newcmt->id = $cmt_id;
             $newcmt->time = userdate($now, get_string('strftimerecent', 'langconfig'));
-            $newcmt->username = $USER->username;
             $newcmt->fullname = fullname($USER);
             $url = new moodle_url('/user/view.php', array('id'=>$USER->id, 'course'=>$this->courseid));
             $newcmt->profileurl = $url->out();
index 5b8155d..8a035c2 100644 (file)
@@ -19,7 +19,7 @@
  * comment_manager is helper class to manage moodle comments in admin page (Reports->Comments)
  *
  * @package   comment
- * @copyright  2010 Dongsheng Cai <dongsheng@moodle.com> 
+ * @copyright  2010 Dongsheng Cai <dongsheng@moodle.com>
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class comment_manager {
@@ -42,14 +42,14 @@ class comment_manager {
         } else {
             $start = $page*$this->perpage;
         }
-        $sql = "SELECT c.id, c.contextid, c.itemid, c.commentarea, c.userid, c.content, u.username, u.firstname, u.lastname, c.timecreated
+        $sql = "SELECT c.id, c.contextid, c.itemid, c.commentarea, c.userid, c.content, u.firstname, u.lastname, c.timecreated
             FROM {comments} c, {user} u
             WHERE u.id=c.userid ORDER BY c.timecreated ASC";
 
         $comments = array();
         if ($records = $DB->get_records_sql($sql, array(), $start, $this->perpage)) {
             foreach ($records as $item) {
-                $item->username = fullname($item);
+                $item->fullname = fullname($item);
                 $item->time = userdate($item->timecreated);
                 $item->content = format_text($item->content);
                 $comments[] = $item;
@@ -122,7 +122,7 @@ class comment_manager {
                 $action .= html_writer::tag('br', null);
                 $action .= html_writer::link($context_url, get_string('commentincontext'), array('target'=>'_blank'));
             }
-            $table->data[] = array($checkbox, $c->username, $c->content, $action);
+            $table->data[] = array($checkbox, $c->fullname, $c->content, $action);
         }
         echo html_writer::table($table);
         echo $OUTPUT->paging_bar($count, $page, $this->perpage, $CFG->wwwroot.'/comment/index.php');