pre_get_posts and BBPress in Swagger Theme

I’m not 100% clear on what the problem is, but I would start with putting the conditions inside the function instead of wrapping the entire function.

add_filter('pre_get_posts', 'query_post_type');

function query_post_type($query) {

  if (!is_admin()){

      global $oswcPostTypes;

      if(empty( get_query_var('suppress_filters' ) ) {
        $post_type = get_query_var('post_type');
        //get theme options
        global $oswc_reviews;   
        if($post_type ) {
            $post_type = $post_type;
            set_query_var('post_type',$post_type);
            return $query;  

        } elseif(!is_page() && !is_preview() && !is_attachment() && !is_search() ) {    
            $post_type = array('post');
            foreach($oswcPostTypes->postTypes as $postType){
                array_push($post_type, $postType->id);
            }
           set_query_var('post_type',$post_type);
            return $query;
        }   
      }
    }
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)