original_string: private function prepare_user_for_display($user, $extrafields, $now) {
          $details = array(
              'userid'              => $user->id,
              'courseid'            => $this->get_course()->id,
              'picture'             => new user_picture($user),
              'userfullnamedisplay' => fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context())),
              'lastaccess'          => get_string('never'),
              'lastcourseaccess'    => get_string('never'),
          );
  
          foreach ($extrafields as $field) {
              $details[$field] = $user->{$field};
          }
  
          // Last time user has accessed the site.
          if (!empty($user->lastaccess)) {
              $details['lastaccess'] = format_time($now - $user->lastaccess);
          }
  
          // Last time user has accessed the course.
          if (!empty($user->lastcourseaccess)) {
              $details['lastcourseaccess'] = format_time($now - $user->lastcourseaccess);
          }
          return $details;
      }
code: private function prepare_user_for_display($user, $extrafields, $now) {
          $details = array(
              'userid'              => $user->id,
              'courseid'            => $this->get_course()->id,
              'picture'             => new user_picture($user),
              'userfullnamedisplay' => fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context())),
              'lastaccess'          => get_string('never'),
              'lastcourseaccess'    => get_string('never'),
          );
  
          foreach ($extrafields as $field) {
              $details[$field] = $user->{$field};
          }
  
          // Last time user has accessed the site.
          if (!empty($user->lastaccess)) {
              $details['lastaccess'] = format_time($now - $user->lastaccess);
          }
  
          // Last time user has accessed the course.
          if (!empty($user->lastcourseaccess)) {
              $details['lastcourseaccess'] = format_time($now - $user->lastcourseaccess);
          }
          return $details;
      }
code_tokens: private function prepare_user_for_display ( $ user , $ extrafields , $ now ) { $ details = array ( 'userid' => $ user -> id , 'courseid' => $ this -> get_course ( ) -> id , 'picture' => new user_picture ( $ user ) , 'userfullnamedisplay' => fullname ( $ user , has_capability ( 'moodle/site:viewfullnames' , $ this -> get_context ( ) ) ) , 'lastaccess' => get_string ( 'never' ) , 'lastcourseaccess' => get_string ( 'never' ) , ) ; foreach ( $ extrafields as $ field ) { $ details [ $ field ] = $ user -> { $ field } ; } // Last time user has accessed the site. if ( ! empty ( $ user -> lastaccess ) ) { $ details [ 'lastaccess' ] = format_time ( $ now - $ user -> lastaccess ) ; } // Last time user has accessed the course. if ( ! empty ( $ user -> lastcourseaccess ) ) { $ details [ 'lastcourseaccess' ] = format_time ( $ now - $ user -> lastcourseaccess ) ; } return $ details ; }
docstring: Prepare a user record for display
  
  This function is called by both {@link get_users_for_display} and {@link get_other_users_for_display} to correctly
  prepare user fields for display
  
  Please note that this function does not check capability for moodle/coures:viewhiddenuserfields
  
  @param object $user The user record
  @param array $extrafields The list of fields as returned from get_extra_user_fields used to determine which
  additional fields may be displayed
  @param int $now The time used for lastaccess calculation
  @return array The fields to be displayed including userid, courseid, picture, firstname, lastcourseaccess, lastaccess and any
  additional fields from $extrafields
docstring_tokens: Prepare a user record for display