Skip to:
Content

bbPress.org

Changeset 5163


Ignore:
Timestamp:
11/23/2013 09:45:06 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Introduce current_view_id to bbPress class variables. Used when calling a topic view shortcode via bbp-single-view so subsequent calls to bbp_view_query are able to retrieve the $view_id via bbp_get_view_id() the same way bbp_get_topic_id() works. Fixes #2457.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bbpress.php

    r5134 r5163  
    244244        /** Queries ***********************************************************/
    245245
     246        $this->current_view_id      = 0; // Current view id
    246247        $this->current_forum_id     = 0; // Current forum id
    247248        $this->current_topic_id     = 0; // Current topic id
  • trunk/includes/common/shortcodes.php

    r5134 r5163  
    126126
    127127        // Unset global ID's
     128        $bbp->current_view_id      = 0;
    128129        $bbp->current_forum_id     = 0;
    129130        $bbp->current_topic_id     = 0;
     
    624625        $this->unset_globals();
    625626
     627        // Set the current view ID
     628        bbpress()->current_view_id = $view_id;
     629
    626630        // Load the view
    627631        bbp_view_query( $view_id );
  • trunk/includes/common/template.php

    r5134 r5163  
    19021902        $bbp = bbpress();
    19031903
    1904         $view = !empty( $view ) ? sanitize_title( $view ) : get_query_var( bbp_get_view_rewrite_id() );
    1905 
    1906         if ( array_key_exists( $view, $bbp->views ) )
     1904        if ( !empty( $view ) ) {
     1905            $view = sanitize_title( $view );
     1906        } elseif ( ! empty( $bbp->current_view_id ) ) {
     1907            $view = $bbp->current_view_id;
     1908        } else {
     1909            $view = get_query_var( bbp_get_view_rewrite_id() );
     1910        }
     1911
     1912        if ( array_key_exists( $view, $bbp->views ) ) {
    19071913            return $view;
     1914        }
    19081915
    19091916        return false;
Note: See TracChangeset for help on using the changeset viewer.