Index: moodle/grade/report/grader/lib.php
--- moodle/grade/report/grader/lib.php Base (1.98.2.66)
+++ moodle/grade/report/grader/lib.php Locally Modified (Based On 1.98.2.66)
@@ -657,7 +657,16 @@
                     }
 
                     $headerlink = $this->gtree->get_element_header($element, true, $this->get_pref('showactivityicons'), false);
-                    $headerhtml .= '<th class=" '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col" onclick="set_col(this.cellIndex)">'
+                    
+                    //need to distinguish between 2 different styling for fixedstudents.
+                    // $fixedstudents == 0, students and grades display in the same table.
+                    // $fixedstudents == 1, students and grades are display in separate table.
+                    if ($fixedstudents) {
+                        $incrementcellindex = '';
+                    } else {
+                        $incrementcellindex = '+1';
+                    }
+                    $headerhtml .= '<th class=" '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col" onclick="set_col(this.cellIndex' . $incrementcellindex . ')">'
                                 . shorten_text($headerlink) . $arrow;
                     $headerhtml .= '</th>';
                 }
@@ -732,7 +741,7 @@
 
                 $userreportcell = '';
                 if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
-                    $a->user = fullname($user);
+                    $a->user = fullname($user, has_capability('moodle/site:viewfullnames', $this->context));
                     $strgradesforuser = get_string('gradesforuser', 'grades', $a);
                     $userreportcell = '<th class="header userreport"><a href="'.$CFG->wwwroot.'/grade/report/'.$CFG->grade_profilereport.'/index.php?id='.$this->courseid.'&amp;userid='.$user->id.'">'
                                     .'<img src="'.$CFG->pixpath.'/t/grades.gif" alt="'.$strgradesforuser.'" title="'.$strgradesforuser.'" /></a></th>';
@@ -741,7 +750,7 @@
                 $studentshtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
                               .'<th class="c'.$columncount++.' user" scope="row" onclick="set_row(this.parentNode.rowIndex);">'.$user_pic
                               .'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->course->id.'">'
-                              .fullname($user)."</a></th>$userreportcell\n";
+                              .fullname($user, has_capability('moodle/site:viewfullnames', $this->context))."</a></th>$userreportcell\n";
 
                 if ($showuseridnumber) {
                     $studentshtml .= '<th class="c'.$columncount++.' useridnumber" onclick="set_row(this.parentNode.rowIndex);">'.
@@ -1014,7 +1023,7 @@
 
                 $userreportcell = '';
                 if (has_capability('gradereport/user:view', $this->context)) {
-                    $a->user = fullname($user);
+                    $a->user = fullname($user, has_capability('moodle/site:viewfullnames', $this->context));
                     $strgradesforuser = get_string('gradesforuser', 'grades', $a);
                     $userreportcell = '<th class="userreport"><a href="'.$CFG->wwwroot.'/grade/report/user/index.php?id='.$this->courseid.'&amp;userid='.$user->id.'">'
                                     .'<img src="'.$CFG->pixpath.'/t/grades.gif" alt="'.$strgradesforuser.'" title="'.$strgradesforuser.'" /></a></th>';
@@ -1023,7 +1032,7 @@
                 $studentshtml .= '<tr class="r'.$this->rowcount++ . $row_classes[$this->rowcount % 2] . '">'
                               .'<th class="c0 user" scope="row" onclick="set_row(this.parentNode.rowIndex);">'.$user_pic
                               .'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->course->id.'">'
-                              .fullname($user)."</a>$userreportcell</th>\n";
+                              .fullname($user, has_capability('moodle/site:viewfullnames', $this->context))."</a>$userreportcell</th>\n";
 
                 if ($showuseridnumber) {
                     $studentshtml .= '<th class="c0 useridnumber" onclick="set_row(this.parentNode.rowIndex);">'. $user->idnumber."</th>\n";
Index: moodle/mod/quiz/report/overview/report.php
--- moodle/mod/quiz/report/overview/report.php Base (1.98.2.49)
+++ moodle/mod/quiz/report/overview/report.php Locally Modified (Based On 1.98.2.49)
@@ -466,10 +466,10 @@
                     }
                     if (!$download){
                         $userlink = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$attempt->userid.
-                                '&amp;course='.$course->id.'">'.fullname($attempt).'</a>';
+                                '&amp;course='.$course->id.'">'.fullname($attempt,has_capability('moodle/site:viewfullnames', $context)).'</a>';
                         $row[] = $userlink;
                     } else {
-                        $row[] = fullname($attempt);
+                        $row[] = fullname($attempt, has_capability('moodle/site:viewfullnames', $context));
                     }
                     
                     if (in_array('idnumber', $columns)){
Index: moodle/user/index.php
--- moodle/user/index.php Base (1.194.2.22)
+++ moodle/user/index.php Locally Modified (Based On 1.194.2.22)
@@ -719,9 +719,9 @@
                 }
 
                 if ($piclink = ($USER->id == $user->id || has_capability('moodle/user:viewdetails', $context) || has_capability('moodle/user:viewdetails', $usercontext))) {
-                    $profilelink = '<strong><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.fullname($user).'</a></strong>';
+                    $profilelink = '<strong><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.fullname($user, has_capability('moodle/site:viewfullnames', $context)).'</a></strong>';
                 } else {
-                    $profilelink = '<strong>'.fullname($user).'</strong>';
+                    $profilelink = '<strong>'.fullname($user, has_capability('moodle/site:viewfullnames', $context)).'</strong>';
                 }
 
                 $data = array (

Index: moodle/mod/assignment/lib.php
--- moodle/mod/assignment/lib.php Base (1.277.2.54)
+++ moodle/mod/assignment/lib.php Locally Modified (Based On 1.277.2.54)
@@ -1300,7 +1323,7 @@
                     }
                 }

-		 $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser) . '</a>';
+		 $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser, has_capability('moodle/site:viewfullnames', $this->context)) . '</a>';
                 $row = array($picture, $userlink, $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade);
                 if ($uses_outcomes) {
                     $row[] = $outcomes;
