Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/01/2011 03:00:10 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Improve logic behind setting the current_forum/topic/reply_id global variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-reply-template.php

    r2962 r2972  
    221221                // Currently viewing a reply
    222222                elseif ( ( bbp_is_reply() || bbp_is_reply_edit() ) && isset( $wp_query->post->ID ) )
    223                         $bbp_reply_id = $wp_query->post->ID;
     223                        $bbp_reply_id = $bbp->current_reply_id = $wp_query->post->ID;
    224224
    225225                // Currently inside a replies loop
    226226                elseif ( isset( $bbp->reply_query->post->ID ) )
    227                         $bbp_reply_id = $bbp->reply_query->post->ID;
     227                        $bbp_reply_id = $bbp->current_reply_id = $bbp->reply_query->post->ID;
    228228
    229229                // Fallback
     
    231231                        $bbp_reply_id = 0;
    232232
    233                 $bbp->current_reply_id = $bbp_reply_id;
     233                // Check if current_reply_id is set, and check post_type if so
     234                if ( !empty( $bbp->current_reply_id ) && ( bbp_get_reply_post_type() != get_post_field( 'post_type', $bbp_reply_id ) ) )
     235                        $bbp->current_reply_id = null;
    234236
    235237                return apply_filters( 'bbp_get_reply_id', (int) $bbp_reply_id, $reply_id );
Note: See TracChangeset for help on using the changeset viewer.