original_string: public static function get_course_completion_join_sql(int $userid, string $prefix, string $joinfield) : array {
          $cccalias = "{$prefix}_ccc"; // Course completion criteria.
          $cmcalias = "{$prefix}_cmc"; // Course modules completion.
          $ccccalias = "{$prefix}_cccc"; // Course completion criteria completion.
  
          $join = "JOIN {course_completion_criteria} {$cccalias} ON {$joinfield} = {$cccalias}.course
               LEFT JOIN {course_modules_completion} {$cmcalias} ON {$cccalias}.moduleinstance = {$cmcalias}.coursemoduleid
                          AND {$cmcalias}.userid = :{$prefix}_moduleuserid
               LEFT JOIN {course_completion_crit_compl} {$ccccalias} ON {$ccccalias}.criteriaid = {$cccalias}.id
                          AND {$ccccalias}.userid = :{$prefix}_courseuserid";
          $where = "{$cmcalias}.id IS NOT NULL OR {$ccccalias}.id IS NOT NULL";
          $params = ["{$prefix}_moduleuserid" => $userid, "{$prefix}_courseuserid" => $userid];
  
          return [$join, $where, $params];
      }
code: public static function get_course_completion_join_sql(int $userid, string $prefix, string $joinfield) : array {
          $cccalias = "{$prefix}_ccc"; // Course completion criteria.
          $cmcalias = "{$prefix}_cmc"; // Course modules completion.
          $ccccalias = "{$prefix}_cccc"; // Course completion criteria completion.
  
          $join = "JOIN {course_completion_criteria} {$cccalias} ON {$joinfield} = {$cccalias}.course
               LEFT JOIN {course_modules_completion} {$cmcalias} ON {$cccalias}.moduleinstance = {$cmcalias}.coursemoduleid
                          AND {$cmcalias}.userid = :{$prefix}_moduleuserid
               LEFT JOIN {course_completion_crit_compl} {$ccccalias} ON {$ccccalias}.criteriaid = {$cccalias}.id
                          AND {$ccccalias}.userid = :{$prefix}_courseuserid";
          $where = "{$cmcalias}.id IS NOT NULL OR {$ccccalias}.id IS NOT NULL";
          $params = ["{$prefix}_moduleuserid" => $userid, "{$prefix}_courseuserid" => $userid];
  
          return [$join, $where, $params];
      }
code_tokens: public static function get_course_completion_join_sql ( int $ userid , string $ prefix , string $ joinfield ) : array { $ cccalias = "{$prefix}_ccc" ; // Course completion criteria. $ cmcalias = "{$prefix}_cmc" ; // Course modules completion. $ ccccalias = "{$prefix}_cccc" ; // Course completion criteria completion. $ join = "JOIN {course_completion_criteria} {$cccalias} ON {$joinfield} = {$cccalias}.course
               LEFT JOIN {course_modules_completion} {$cmcalias} ON {$cccalias}.moduleinstance = {$cmcalias}.coursemoduleid
                          AND {$cmcalias}.userid = :{$prefix}_moduleuserid
               LEFT JOIN {course_completion_crit_compl} {$ccccalias} ON {$ccccalias}.criteriaid = {$cccalias}.id
                          AND {$ccccalias}.userid = :{$prefix}_courseuserid" ; $ where = "{$cmcalias}.id IS NOT NULL OR {$ccccalias}.id IS NOT NULL" ; $ params = [ "{$prefix}_moduleuserid" => $ userid , "{$prefix}_courseuserid" => $ userid ] ; return [ $ join , $ where , $ params ] ; }
docstring: Get join sql to retrieve courses the user is in.
  
  @param  int $userid The user ID
  @param  string $prefix A unique prefix for these joins.
  @param  string $joinfield A field to join these tables to. Joins to course ID.
  @return array The join, where, and params for this join.
docstring_tokens: Get join sql to retrieve courses the user is in .