- Timestamp:
- 03/18/2023 09:42:31 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/classes/class-bp-groups-component.php
r13432 r13437 375 375 376 376 // Set default Group creation steps. 377 $group_creation_steps = array( 378 'group-details' => array( 379 'name' => _x( 'Details', 'Group screen nav', 'buddypress' ), 380 'position' => 0 381 ), 382 'group-settings' => array( 383 'name' => _x( 'Settings', 'Group screen nav', 'buddypress' ), 384 'position' => 10 385 ) 386 ); 387 388 // If avatar uploads are not disabled, add avatar option. 377 $group_creation_steps = bp_get_group_screens( 'create' ); 378 379 // If avatar uploads are disabled, remove avatar view. 389 380 $disabled_avatar_uploads = (int) bp_disable_group_avatar_uploads(); 390 if ( ! $disabled_avatar_uploads && $bp->avatar->show_avatars ) { 391 $group_creation_steps['group-avatar'] = array( 392 'name' => _x( 'Photo', 'Group screen nav', 'buddypress' ), 393 'position' => 20 394 ); 395 } 396 397 if ( bp_group_use_cover_image_header() ) { 398 $group_creation_steps['group-cover-image'] = array( 399 'name' => _x( 'Cover Image', 'Group screen nav', 'buddypress' ), 400 'position' => 25 401 ); 402 } 403 404 // If invitations are enabled, add invitations. 405 if ( bp_is_active( 'groups', 'invitations' ) ) { 406 $group_creation_steps['group-invites'] = array( 407 'name' => _x( 'Invites', 'Group screen nav', 'buddypress' ), 408 'position' => 30 409 ); 381 if ( $disabled_avatar_uploads || empty( $bp->avatar->show_avatars ) ) { 382 unset( $group_creation_steps['group-avatar'] ); 383 } 384 385 // If cover images are disabled, remove its view. 386 if ( ! bp_group_use_cover_image_header() ) { 387 unset( $group_creation_steps['group-cover-image'] ); 388 } 389 390 // If the invitations feature is not active, remove the corresponding view. 391 if ( ! bp_is_active( 'groups', 'invitations' ) ) { 392 unset( $group_creation_steps['group-invites'] ); 410 393 } 411 394 … … 415 398 * @since 1.1.0 416 399 * 417 * @param array $ valueArray of preconfigured group creation steps.400 * @param array $group_creation_steps Array of preconfigured group creation steps. 418 401 */ 419 402 $this->group_creation_steps = apply_filters( 'groups_create_group_steps', $group_creation_steps ); … … 542 525 543 526 // Prepare for a redirect to the canonical URL. 544 $bp->canonical_stack['base_url'] = bp_get_group_ permalink( $this->current_group );527 $bp->canonical_stack['base_url'] = bp_get_group_url( $this->current_group ); 545 528 546 529 if ( bp_current_action() ) { … … 670 653 ), 'groups' ); 671 654 672 $group_link = bp_get_group_ permalink( $this->current_group );655 $group_link = bp_get_group_url( $this->current_group ); 673 656 674 657 // Add the "Home" subnav item, as this will always be present. … … 919 902 'id' => 'my-account-' . $this->id . '-create', 920 903 'title' => _x( 'Create a Group', 'My Account Groups sub nav', 'buddypress' ), 921 'href' => trailingslashit( bp_get_groups_directory_permalink() . 'create' ), 904 'href' => bp_get_groups_directory_url( 905 array( 906 'create_single_item' => 1, 907 ) 908 ), 922 909 'position' => 90 923 910 ); … … 1009 996 // Just let BP Component fire 'bp_groups_register_taxonomies'. 1010 997 return parent::register_taxonomies(); 998 } 999 1000 /** 1001 * Adds the Groups directory type & Group create rewrite tags. 1002 * 1003 * @since 12.0.0 1004 * 1005 * @param array $rewrite_tags Optional. See BP_Component::add_rewrite_tags() for 1006 * description. 1007 */ 1008 public function add_rewrite_tags( $rewrite_tags = array() ) { 1009 $rewrite_tags = array( 1010 'directory_type' => '([^/]+)', 1011 'create_single_item' => '([1]{1,})', 1012 'create_single_item_variables' => '(.+?)', 1013 ); 1014 1015 parent::add_rewrite_tags( $rewrite_tags ); 1016 } 1017 1018 /** 1019 * Adds the Groups directory type & Group create rewrite rules. 1020 * 1021 * @since 12.0.0 1022 * 1023 * @param array $rewrite_rules Optional. See BP_Component::add_rewrite_rules() for 1024 * description. 1025 */ 1026 public function add_rewrite_rules( $rewrite_rules = array() ) { 1027 $create_slug = bp_rewrites_get_slug( 'groups', 'group_create', 'create' ); 1028 1029 $rewrite_rules = array( 1030 'directory_type' => array( 1031 'regex' => $this->root_slug . '/' . bp_get_groups_group_type_base() . '/([^/]+)/?$', 1032 'order' => 50, 1033 'query' => 'index.php?' . $this->rewrite_ids['directory'] . '=1&' . $this->rewrite_ids['directory_type'] . '=$matches[1]', 1034 ), 1035 'create_single_item' => array( 1036 'regex' => $this->root_slug . '/' . $create_slug . '/?$', 1037 'order' => 40, 1038 'query' => 'index.php?' . $this->rewrite_ids['directory'] . '=1&' . $this->rewrite_ids['create_single_item'] . '=1', 1039 ), 1040 'create_single_item_variables' => array( 1041 'regex' => $this->root_slug . '/' . $create_slug . '/(.+?)/?$', 1042 'order' =>30, 1043 'query' => 'index.php?' . $this->rewrite_ids['directory'] . '=1&' . $this->rewrite_ids['create_single_item'] . '=1&' . $this->rewrite_ids['create_single_item_variables'] . '=$matches[1]', 1044 ), 1045 ); 1046 1047 parent::add_rewrite_rules( $rewrite_rules ); 1011 1048 } 1012 1049
Note: See TracChangeset
for help on using the changeset viewer.