original_string: protected function get_post_author($userid, $course, $forum, $cm, $context) {
          if (!isset($this->users[$userid])) {
              // This user no longer exists.
              return false;
          }
  
          $user = $this->users[$userid];
  
          if (!isset($user->groups)) {
              // Initialise the groups list.
              $user->groups = [];
          }
  
          if (!isset($user->groups[$forum->id])) {
              $user->groups[$forum->id] = groups_get_all_groups($course->id, $user->id, $cm->groupingid);
          }
  
          // Clone the user object to prevent leaks between messages.
          return (object) (array) $user;
      }
code: protected function get_post_author($userid, $course, $forum, $cm, $context) {
          if (!isset($this->users[$userid])) {
              // This user no longer exists.
              return false;
          }
  
          $user = $this->users[$userid];
  
          if (!isset($user->groups)) {
              // Initialise the groups list.
              $user->groups = [];
          }
  
          if (!isset($user->groups[$forum->id])) {
              $user->groups[$forum->id] = groups_get_all_groups($course->id, $user->id, $cm->groupingid);
          }
  
          // Clone the user object to prevent leaks between messages.
          return (object) (array) $user;
      }
code_tokens: protected function get_post_author ( $ userid , $ course , $ forum , $ cm , $ context ) { if ( ! isset ( $ this -> users [ $ userid ] ) ) { // This user no longer exists. return false ; } $ user = $ this -> users [ $ userid ] ; if ( ! isset ( $ user -> groups ) ) { // Initialise the groups list. $ user -> groups = [ ] ; } if ( ! isset ( $ user -> groups [ $ forum -> id ] ) ) { $ user -> groups [ $ forum -> id ] = groups_get_all_groups ( $ course -> id , $ user -> id , $ cm -> groupingid ) ; } // Clone the user object to prevent leaks between messages. return ( object ) ( array ) $ user ; }
docstring: Fetch and initialise the post author.
  
  @param   int         $userid The id of the user to fetch
  @param   \stdClass   $course
  @param   \stdClass   $forum
  @param   \stdClass   $cm
  @param   \context    $context
  @return  \stdClass
docstring_tokens: Fetch and initialise the post author .