Changeset 13505
- Timestamp:
- 06/22/2023 04:08:38 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/classes/class-bp-blogs-component.php
r13503 r13505 82 82 'has_directory' => is_multisite(), // Non-multisite installs don't need a top-level Sites directory, since there's only one site. 83 83 'rewrite_ids' => array( 84 'directory' => 'blogs', 85 'create_single_item' => 'blog_create', 84 'directory' => 'blogs', 85 'create_single_item' => 'blog_create', 86 'directory_action' => 'blogs_action', 87 'directory_action_variables' => 'blogs_action_variables' 86 88 ), 87 89 'directory_title' => isset( $bp->pages->blogs->title ) ? $bp->pages->blogs->title : $default_directory_title, … … 398 400 public function add_rewrite_tags( $rewrite_tags = array() ) { 399 401 $rewrite_tags = array( 400 'create_single_item' => '([1]{1,})', 402 'create_single_item' => '([1]{1,})', 403 'directory_action' => '([^/]+)', 404 'directory_action_variables' => '(.+?)', 401 405 ); 402 406 … … 416 420 417 421 $rewrite_rules = array( 422 'directory_action_variables' => array( 423 'regex' => $this->root_slug . '/([^/]+)/(.+?)/?$', 424 'order' => 70, 425 'query' => 'index.php?' . $this->rewrite_ids['directory'] . '=1&' . $this->rewrite_ids['directory_action'] . '=$matches[1]&' . $this->rewrite_ids['directory_action_variables'] . '=$matches[2]', 426 ), 427 'directory_action' => array( 428 'regex' => $this->root_slug . '/([^/]+)/?$', 429 'order' => 60, 430 'query' => 'index.php?' . $this->rewrite_ids['directory'] . '=1&' . $this->rewrite_ids['directory_action'] . '=$matches[1]', 431 ), 418 432 'create_single_item' => array( 419 433 'regex' => $this->root_slug . '/' . $create_slug . '/?$', … … 453 467 if ( 1 === (int) $query->get( $this->rewrite_ids['directory'] ) ) { 454 468 $bp->current_component = 'blogs'; 455 456 $current_action = $query->get( $this->rewrite_ids['single_item_action'] ); 457 if ( $current_action ) { 458 $bp->current_action = $current_action; 459 } 460 461 $action_variables = $query->get( $this->rewrite_ids['single_item_action_variables'] ); 462 if ( $action_variables ) { 463 if ( ! is_array( $action_variables ) ) { 464 $bp->action_variables = explode( '/', ltrim( $action_variables, '/' ) ); 465 } else { 466 $bp->action_variables = $action_variables; 469 $is_blog_create = 1 === (int) $query->get( $this->rewrite_ids['create_single_item'] ); 470 471 if ( $is_blog_create ) { 472 $bp->current_action = 'create'; 473 } else { 474 $current_action = $query->get( $this->rewrite_ids['directory_action'] ); 475 if ( $current_action ) { 476 $bp->current_action = $current_action; 467 477 } 478 479 $action_variables = $query->get( $this->rewrite_ids['directory_action_variables'] ); 480 if ( $action_variables ) { 481 if ( ! is_array( $action_variables ) ) { 482 $bp->action_variables = explode( '/', ltrim( $action_variables, '/' ) ); 483 } else { 484 $bp->action_variables = $action_variables; 485 } 486 } 468 487 } 469 488 470 489 // Set the BuddyPress queried object. 471 if ( isset( $bp->pages->blogs->id ) ) {490 if ( isset( $bp->pages->blogs->id ) && ( ! bp_current_action() || bp_is_current_action( 'create' ) ) ) { 472 491 $query->queried_object = get_post( $bp->pages->blogs->id ); 473 492 $query->queried_object_id = $query->queried_object->ID;
Note: See TracChangeset
for help on using the changeset viewer.