Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/29/2023 05:51:12 AM (16 months ago)
Author:
imath
Message:

Make sure BP_Component::parse_query() always run

Only running it when BP Rewrites are on is not the right way to go as some plugins might have been using the WP Rewrites API for a while and might have extended this method from their component's class.

Instead of only running this method if BP Rewrites are on, we're adding a URL parser check inside each component having a directory to figure out whether it's needed to set BP URI globals.

See #4954
Fixes #8908
Closes https://github.com/buddypress/buddypress/pull/109

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/classes/class-bp-activity-component.php

    r13471 r13492  
    506506     */
    507507    public function parse_query( $query ) {
     508        /*
     509         * If BP Rewrites are not in use, no need to parse BP URI globals another time.
     510         * Legacy Parser should have already set these.
     511         */
     512        if ( 'rewrites' !== bp_core_get_query_parser() ) {
     513            return parent::parse_query( $query );
     514        }
     515
    508516        if ( bp_is_directory_homepage( $this->id ) ) {
    509517            $query->set( $this->rewrite_ids['directory'], 1 );
Note: See TracChangeset for help on using the changeset viewer.