Changeset 13455 for trunk/src/bp-blogs/classes/class-bp-blogs-component.php
- Timestamp:
- 04/20/2023 02:30:11 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/classes/class-bp-blogs-component.php
r13450 r13455 435 435 436 436 parent::add_rewrite_rules( $rewrite_rules ); 437 } 438 439 /** 440 * Parse the WP_Query and eventually display the component's directory or single item. 441 * 442 * @since 12.0.0 443 * 444 * @param WP_Query $query Required. See BP_Component::parse_query() for 445 * description. 446 */ 447 public function parse_query( $query ) { 448 if ( ! is_multisite() ) { 449 return parent::parse_query( $query ); 450 } 451 452 // Get the BuddyPress main instance. 453 $bp = buddypress(); 454 455 if ( bp_is_directory_homepage( $this->id ) ) { 456 $query->set( $this->rewrite_ids['directory'], 1 ); 457 } 458 459 if ( 1 === (int) $query->get( $this->rewrite_ids['directory'] ) ) { 460 $bp->current_component = 'blogs'; 461 462 $current_action = $query->get( $this->rewrite_ids['single_item_action'] ); 463 if ( $current_action ) { 464 $bp->current_action = $current_action; 465 } 466 467 $action_variables = $query->get( $this->rewrite_ids['single_item_action_variables'] ); 468 if ( $action_variables ) { 469 if ( ! is_array( $action_variables ) ) { 470 $bp->action_variables = explode( '/', ltrim( $action_variables, '/' ) ); 471 } else { 472 $bp->action_variables = $action_variables; 473 } 474 } 475 476 // Set the BuddyPress queried object. 477 if ( isset( $bp->pages->blogs->id ) ) { 478 $query->queried_object = get_post( $bp->pages->blogs->id ); 479 $query->queried_object_id = $query->queried_object->ID; 480 } 481 } 482 483 parent::parse_query( $query ); 437 484 } 438 485
Note: See TracChangeset
for help on using the changeset viewer.