original_string: public function searchByUser($userId)
      {
          $query = static::find();
          $query->where(['author_id' => $userId]);
          if (Podium::getInstance()->user->isGuest) {
              $query->joinWith(['forum' => function ($q) {
                  $q->where([Forum::tableName() . '.visible' => 1]);
              }]);
          }
  
          $dataProvider = new ActiveDataProvider([
              'query' => $query,
              'pagination' => false,
          ]);
          $dataProvider->sort->defaultOrder = [
              'updated_at' => SORT_DESC,
              'id' => SORT_ASC
          ];
  
          return $dataProvider;
      }
code: public function searchByUser($userId)
      {
          $query = static::find();
          $query->where(['author_id' => $userId]);
          if (Podium::getInstance()->user->isGuest) {
              $query->joinWith(['forum' => function ($q) {
                  $q->where([Forum::tableName() . '.visible' => 1]);
              }]);
          }
  
          $dataProvider = new ActiveDataProvider([
              'query' => $query,
              'pagination' => false,
          ]);
          $dataProvider->sort->defaultOrder = [
              'updated_at' => SORT_DESC,
              'id' => SORT_ASC
          ];
  
          return $dataProvider;
      }
code_tokens: public function searchByUser ( $ userId ) { $ query = static :: find ( ) ; $ query -> where ( [ 'author_id' => $ userId ] ) ; if ( Podium :: getInstance ( ) -> user -> isGuest ) { $ query -> joinWith ( [ 'forum' => function ( $ q ) { $ q -> where ( [ Forum :: tableName ( ) . '.visible' => 1 ] ) ; } ] ) ; } $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , 'pagination' => false , ] ) ; $ dataProvider -> sort -> defaultOrder = [ 'updated_at' => SORT_DESC , 'id' => SORT_ASC ] ; return $ dataProvider ; }
docstring: Searches for threads created by user of given ID.
  @param int $userId
  @return ActiveDataProvider
docstring_tokens: Searches for threads created by user of given ID .