Skip to:
Content

BuddyPress.org

Ticket #6230: bp-core-theme-compatibility.php.1424377688.diff

File bp-core-theme-compatibility.php.1424377688.diff, 783 bytes (added by mikelopez, 10 years ago)

Set proper page ID if one exists in $bp->pages and $argsID? is empty (please ignore previous patch)

  • bp-core-theme-compatibility.php

     
    453453 *        properties of {@link WP_Post}; see that class for more details.
    454454 */
    455455function bp_theme_compat_reset_post( $args = array() ) {
    456         global $wp_query, $post;
     456        global $wp_query, $post, $bp;
     457
     458        // set proper page ID if one exists in $bp->pages and $args['ID'] is empty
     459        if ( empty( $args['ID'] ) ) {
     460                foreach ( $bp->pages AS $page ) {
     461                        if ( $page->name == $bp->unfiltered_uri[$bp->unfiltered_uri_offset] ) {
     462                                $args['ID'] = $page->id;
     463                                break;
     464                        }
     465                }
     466        }
    457467
    458468        // Switch defaults if post is set
    459469        if ( isset( $wp_query->post ) ) {