Skip to:
Content

bbPress.org

Ticket #2308: 2308.2.patch

File 2308.2.patch, 1.5 KB (added by johnjamesjacoby, 12 years ago)
  • includes/common/functions.php

     
    15321532                // Forum/Topic/Reply Feed
    15331533                if ( isset( $query_vars['post_type'] ) ) {
    15341534                   
     1535                        // Matched post type
     1536                        $post_type = false;
     1537
     1538                        // Post types to check
     1539                        $post_types = array(
     1540                                bbp_get_forum_post_type(),
     1541                                bbp_get_topic_post_type(),
     1542                                bbp_get_reply_post_type()
     1543                        );
     1544
     1545                        // Cast query vars as array outside of foreach loop
     1546                        $qv_array = (array) $query_vars['post_type'];
     1547
     1548                        // Check if this query is for a bbPress post type
     1549                        foreach ( $post_types as $bbp_pt ) {
     1550                            if ( in_array( $bbp_pt, $qv_array, true ) ) {
     1551                                    $post_type = $bbp_pt;
     1552                                    break;
     1553                            }
     1554                        }
     1555
     1556                        // Looking at a bbPress post type
     1557                        if ( ! empty( $post_type ) ) {
     1558
    15351559                        // Supported select query vars
    15361560                        $select_query_vars = array(
    1537                                 'p'                      => false,
    1538                                 'name'                   => false,
    1539                                 $query_vars['post_type'] => false
     1561                                        'p'        => false,
     1562                                        'name'     => false,
     1563                                        $post_type => false,
    15401564                        );
    15411565
    15421566                        // Setup matched variables to select
     
    15501574                        $select_query_vars = array_filter( $select_query_vars );
    15511575
    15521576                        // What bbPress post type are we looking for feeds on?
    1553                         switch ( $query_vars['post_type'] ) {
     1577                                switch ( $post_type ) {
    15541578
    15551579                                // Forum
    15561580                                case bbp_get_forum_post_type() :
     
    16861710
    16871711                                        break;
    16881712                        }
     1713                        }
    16891714
    16901715                // Single Topic Vview
    16911716                } elseif ( isset( $query_vars['bbp_view'] ) ) {