- Timestamp:
- 04/20/2023 02:30:11 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-component.php
r13450 r13455 498 498 499 499 /** 500 * Parse the WP_Query and eventually display the component's directory or single item. 501 * 502 * @since 12.0.0 503 * 504 * @param WP_Query $query Required. See BP_Component::parse_query() for 505 * description. 506 */ 507 public function parse_query( $query ) { 508 if ( bp_is_directory_homepage( $this->id ) ) { 509 $query->set( $this->rewrite_ids['directory'], 1 ); 510 } 511 512 if ( 1 === (int) $query->get( $this->rewrite_ids['directory'] ) ) { 513 $bp = buddypress(); 514 515 // Set the Activity component as current. 516 $bp->current_component = 'activity'; 517 518 $current_action = $query->get( $this->rewrite_ids['single_item_action'] ); 519 if ( $current_action ) { 520 $bp->current_action = $current_action; 521 } 522 523 $action_variables = $query->get( $this->rewrite_ids['single_item_action_variables'] ); 524 if ( $action_variables ) { 525 if ( ! is_array( $action_variables ) ) { 526 $bp->action_variables = explode( '/', ltrim( $action_variables, '/' ) ); 527 } else { 528 $bp->action_variables = $action_variables; 529 } 530 } 531 532 // Set the BuddyPress queried object. 533 if ( isset( $bp->pages->activity->id ) ) { 534 $query->queried_object = get_post( $bp->pages->activity->id ); 535 $query->queried_object_id = $query->queried_object->ID; 536 } 537 } 538 539 parent::parse_query( $query ); 540 } 541 542 /** 500 543 * Init the BP REST API. 501 544 *
Note: See TracChangeset
for help on using the changeset viewer.