original_string: public function is_participant($userid=null) {
          global $USER, $DB;
  
          if (is_null($userid)) {
              $userid = $USER->id;
          }
  
          list($sql, $params) = $this->get_participants_sql();
  
          if (empty($sql)) {
              return false;
          }
  
          $sql = "SELECT COUNT(*)
                    FROM {user} uxx
                    JOIN ({$sql}) pxx ON uxx.id = pxx.id
                   WHERE uxx.id = :uxxid";
          $params['uxxid'] = $userid;
  
          if ($DB->count_records_sql($sql, $params)) {
              return true;
          }
  
          return false;
      }
code: public function is_participant($userid=null) {
          global $USER, $DB;
  
          if (is_null($userid)) {
              $userid = $USER->id;
          }
  
          list($sql, $params) = $this->get_participants_sql();
  
          if (empty($sql)) {
              return false;
          }
  
          $sql = "SELECT COUNT(*)
                    FROM {user} uxx
                    JOIN ({$sql}) pxx ON uxx.id = pxx.id
                   WHERE uxx.id = :uxxid";
          $params['uxxid'] = $userid;
  
          if ($DB->count_records_sql($sql, $params)) {
              return true;
          }
  
          return false;
      }
code_tokens: public function is_participant ( $ userid = null ) { global $ USER , $ DB ; if ( is_null ( $ userid ) ) { $ userid = $ USER -> id ; } list ( $ sql , $ params ) = $ this -> get_participants_sql ( ) ; if ( empty ( $ sql ) ) { return false ; } $ sql = "SELECT COUNT(*)
                    FROM {user} uxx
                    JOIN ({$sql}) pxx ON uxx.id = pxx.id
                   WHERE uxx.id = :uxxid" ; $ params [ 'uxxid' ] = $ userid ; if ( $ DB -> count_records_sql ( $ sql , $ params ) ) { return true ; } return false ; }
docstring: Checks if the given user is an actively enrolled participant in the workshop
  
  @param int $userid, defaults to the current $USER
  @return boolean
docstring_tokens: Checks if the given user is an actively enrolled participant in the workshop