Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/10/2013 04:18:43 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Update bbp_request_feed_trap() to accept more query variables; fixes issues with non-pretty permalinks. Props alex-ye. Fixes #2296.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/functions.php

    r4832 r4838  
    14921492        // Forum/Topic/Reply Feed
    14931493        if ( isset( $query_vars['post_type'] ) ) {
     1494                   
     1495            // Supported select query vars
     1496            $select_query_vars = array(
     1497                'p'                      => false,
     1498                'name'                   => false,
     1499                $query_vars['post_type'] => false
     1500            );
     1501
     1502            // Setup matched variables to select
     1503            foreach ( $query_vars as $key => $value ) {
     1504                if ( isset( $select_query_vars[$key] ) ) {
     1505                    $select_query_vars[$key] = $value;
     1506                }
     1507            }
     1508
     1509            // Remove any empties
     1510            $select_query_vars = array_filter( $select_query_vars );
    14941511
    14951512            // What bbPress post type are we looking for feeds on?
     
    15031520
    15041521                    // Single forum
    1505                     if ( isset( $query_vars[bbp_get_forum_post_type()] ) ) {
     1522                    if ( !empty( $select_query_vars ) ) {
    15061523
    15071524                        // Load up our own query
    1508                         query_posts( array(
     1525                        query_posts( array_merge( array(
    15091526                            'post_type' => bbp_get_forum_post_type(),
    1510                             'name'      => $query_vars[bbp_get_forum_post_type()],
    15111527                            'feed'      => true
    1512                         ) );
     1528                        ), $select_query_vars ) );
    15131529
    15141530                        // Restrict to specific forum ID
     
    15301546                            'post_type'      => bbp_get_reply_post_type(),
    15311547                            'post_parent'    => 'any',
    1532                             'post_status'    => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
     1548                            'post_status'    => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
    15331549                            'posts_per_page' => bbp_get_replies_per_rss_page(),
    15341550                            'order'          => 'DESC',
     
    15481564                            'post_type'      => bbp_get_topic_post_type(),
    15491565                            'post_parent'    => bbp_get_forum_id(),
    1550                             'post_status'    => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
     1566                            'post_status'    => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
    15511567                            'posts_per_page' => bbp_get_topics_per_rss_page(),
    15521568                            'order'          => 'DESC'
     
    15601576
    15611577                        // Exclude private/hidden forums if not looking at single
    1562                         if ( empty( $query_vars['forum'] ) )
     1578                        if ( empty( $select_query_vars ) )
    15631579                            $meta_query = array( bbp_exclude_forum_ids( 'meta_query' ) );
    15641580
     
    15691585                            'post_type'      => array( bbp_get_reply_post_type(), bbp_get_topic_post_type() ),
    15701586                            'post_parent'    => 'any',
    1571                             'post_status'    => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
     1587                            'post_status'    => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
    15721588                            'posts_per_page' => bbp_get_replies_per_rss_page(),
    15731589                            'order'          => 'DESC',
     
    15851601
    15861602                    // Single topic
    1587                     if ( isset( $query_vars[bbp_get_topic_post_type()] ) ) {
     1603                    if ( !empty( $select_query_vars ) ) {
    15881604
    15891605                        // Load up our own query
    1590                         query_posts( array(
     1606                        query_posts( array_merge( array(
    15911607                            'post_type' => bbp_get_topic_post_type(),
    1592                             'name'      => $query_vars[bbp_get_topic_post_type()],
    15931608                            'feed'      => true
    1594                         ) );
     1609                        ), $select_query_vars ) );
    15951610
    15961611                        // Output the feed
     
    16261641
    16271642                    // All replies
    1628                     if ( !isset( $query_vars[bbp_get_reply_post_type()] ) ) {
     1643                    if ( empty( $select_query_vars ) ) {
    16291644                        bbp_display_replies_feed_rss2( $the_query );
    16301645                    }
Note: See TracChangeset for help on using the changeset viewer.