Changeset 13449
- Timestamp:
- 04/08/2023 06:31:46 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/actions/random.php
r11934 r13449 26 26 // No multisite and still called, always redirect to root. 27 27 } else { 28 bp_core_redirect( bp_ core_get_root_domain() );28 bp_core_redirect( bp_get_root_url() ); 29 29 } 30 30 } -
trunk/src/bp-core/admin/bp-core-admin-functions.php
r13433 r13449 513 513 * @param array $settings_tabs The BP Admin settings tabs. 514 514 */ 515 return apply_filters( 'bp_core_get_admin_settings_tabs', $settings_tabs ); 515 $settings_tabs = apply_filters( 'bp_core_get_admin_settings_tabs', $settings_tabs ); 516 517 // Sort tabs before returning it. 518 ksort( $settings_tabs ); 519 520 return $settings_tabs; 516 521 } 517 522 … … 559 564 * @param array $tools_tabs The BP Admin tools tabs. 560 565 */ 561 return apply_filters( 'bp_core_get_admin_tools_tabs', $tools_tabs ); 566 $tools_tabs = apply_filters( 'bp_core_get_admin_tools_tabs', $tools_tabs ); 567 568 // Sort tabs before returning it. 569 ksort( $tools_tabs ); 570 571 return $tools_tabs; 562 572 } 563 573 -
trunk/src/bp-core/bp-core-functions.php
r13444 r13449 1103 1103 1104 1104 /** URI ***********************************************************************/ 1105 1106 /**1107 * Return the domain for the root blog.1108 *1109 * Eg: http://example.com OR https://example.com1110 *1111 * @since 1.0.01112 * @deprecated 12.0.01113 *1114 * @return string The domain URL for the blog.1115 */1116 function bp_core_get_root_domain() {1117 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_rewrites_get_root_url()' );1118 $domain = bp_rewrites_get_root_url();1119 1120 /**1121 * Filters the domain for the root blog.1122 *1123 * @since 1.0.11124 * @deprecated 12.0.0 Use {@see 'bp_rewrites_get_root_url'} instead.1125 *1126 * @param string $domain The domain URL for the blog.1127 */1128 return apply_filters_deprecated( 'bp_core_get_root_domain', array( $domain ), '12.0.0', 'bp_rewrites_get_root_url' );1129 }1130 1105 1131 1106 /** -
trunk/src/bp-core/bp-core-template.php
r13448 r13449 1451 1451 echo esc_url( bp_get_root_url() ); 1452 1452 } 1453 1454 /**1455 * Output the "root domain", the URL of the BP root blog.1456 *1457 * @since 1.1.01458 * @deprecated 12.0.01459 */1460 function bp_root_domain() {1461 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_root_url()' );1462 bp_root_url();1463 }1464 /**1465 * Return the "root domain", the URL of the BP root blog.1466 *1467 * @since 1.1.01468 * @deprecated 12.0.01469 *1470 * @return string URL of the BP root blog.1471 */1472 function bp_get_root_domain() {1473 /*1474 * This function is used at many places and we need to review all this1475 * places during the 12.0 development cycle. Using BP Rewrites means we1476 * cannot concatenate URL chunks to build our URL anymore. We now need1477 * to use `bp_rewrites_get_url( $array )` and make sure to use the right1478 * arguments inside this `$array`.1479 *1480 * @todo Once every link reviewed, we'll be able to remove this check1481 * and let PHPUnit tell us the one we forgot, eventually!1482 */1483 if ( ! buddypress()->is_phpunit_running ) {1484 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_root_url()' );1485 }1486 1487 $domain = bp_get_root_url();1488 1489 /**1490 * Filters the "root domain", the URL of the BP root blog.1491 *1492 * @since 1.2.41493 * @deprecated 12.0.0 Use {@see 'bp_get_root_url'} instead.1494 *1495 * @param string $domain URL of the BP root blog.1496 */1497 return apply_filters_deprecated( 'bp_core_get_root_domain', array( $domain ), '12.0.0', 'bp_get_root_url' );1498 }1499 1453 1500 1454 /** -
trunk/src/bp-core/deprecated/12.0.php
r13446 r13449 12 12 } 13 13 14 /** 15 * Add support for a top-level ("root") component. 16 * 17 * This function originally (pre-1.5) let plugins add support for pages in the 18 * root of the install. These root level pages are now handled by actual 19 * WordPress pages and this function is now a convenience for compatibility 20 * with the new method. 21 * 22 * @since 1.0.0 23 * @deprecated 12.0.0 24 * 25 * @param string $slug The slug of the component being added to the root list. 26 */ 27 function bp_core_add_root_component( $slug ) { 28 _deprecated_function( __FUNCTION__, '12.0.0' ); 14 // These functions has been moved to the BP Classic plugin. 15 if ( ! function_exists( 'bp_classic' ) ) { 16 /** 17 * Add support for a top-level ("root") component. 18 * 19 * This function originally (pre-1.5) let plugins add support for pages in the 20 * root of the install. These root level pages are now handled by actual 21 * WordPress pages and this function is now a convenience for compatibility 22 * with the new method. 23 * 24 * @since 1.0.0 25 * @deprecated 12.0.0 26 * 27 * @param string $slug The slug of the component being added to the root list. 28 */ 29 function bp_core_add_root_component( $slug ) { 30 _deprecated_function( __FUNCTION__, '12.0.0' ); 31 } 32 33 /** 34 * Return the domain for the root blog. 35 * 36 * Eg: http://example.com OR https://example.com 37 * 38 * @since 1.0.0 39 * @deprecated 12.0.0 40 * 41 * @return string The domain URL for the blog. 42 */ 43 function bp_core_get_root_domain() { 44 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_rewrites_get_root_url()' ); 45 $domain = bp_rewrites_get_root_url(); 46 47 /** 48 * Filters the domain for the root blog. 49 * 50 * @since 1.0.1 51 * @deprecated 12.0.0 Use {@see 'bp_rewrites_get_root_url'} instead. 52 * 53 * @param string $domain The domain URL for the blog. 54 */ 55 return apply_filters_deprecated( 'bp_core_get_root_domain', array( $domain ), '12.0.0', 'bp_rewrites_get_root_url' ); 56 } 57 58 /** 59 * Return the "root domain", the URL of the BP root blog. 60 * 61 * @since 1.1.0 62 * @deprecated 12.0.0 63 * 64 * @return string URL of the BP root blog. 65 */ 66 function bp_get_root_domain() { 67 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_root_url()' ); 68 $domain = bp_get_root_url(); 69 70 /** 71 * Filters the "root domain", the URL of the BP root blog. 72 * 73 * @since 1.2.4 74 * @deprecated 12.0.0 Use {@see 'bp_get_root_url'} instead. 75 * 76 * @param string $domain URL of the BP root blog. 77 */ 78 return apply_filters_deprecated( 'bp_get_root_domain', array( $domain ), '12.0.0', 'bp_get_root_url' ); 79 } 80 81 /** 82 * Output the "root domain", the URL of the BP root blog. 83 * 84 * @since 1.1.0 85 * @deprecated 12.0.0 86 */ 87 function bp_root_domain() { 88 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_root_url()' ); 89 bp_root_url(); 90 } 91 92 /** 93 * Renders the page mapping admin panel. 94 * 95 * @since 1.6.0 96 * @deprecated 12.0.0 97 */ 98 function bp_core_admin_slugs_settings() { 99 _deprecated_function( __FUNCTION__, '12.0.0' ); 100 } 101 102 /** 103 * Generate a list of directory pages, for use when building Components panel markup. 104 * 105 * @since 2.4.1 106 * @deprecated 12.0.0 107 * 108 * @return array 109 */ 110 function bp_core_admin_get_directory_pages() { 111 _deprecated_function( __FUNCTION__, '12.0.0' ); 112 113 $directory_pages = (array) bp_core_get_directory_pages(); 114 $return = wp_list_pluck( $directory_pages, 'name', 'id' ); 115 116 return apply_filters_deprecated( 'bp_directory_pages', array( $return ), '12.0.0' ); 117 } 118 119 /** 120 * Generate a list of static pages, for use when building Components panel markup. 121 * 122 * By default, this list contains 'register' and 'activate'. 123 * 124 * @since 2.4.1 125 * @deprecated 12.0.0 126 * 127 * @return array 128 */ 129 function bp_core_admin_get_static_pages() { 130 _deprecated_function( __FUNCTION__, '12.0.0' ); 131 132 $static_pages = array( 133 'register' => __( 'Register', 'buddypress' ), 134 'activate' => __( 'Activate', 'buddypress' ), 135 ); 136 137 return apply_filters_deprecated( 'bp_directory_pages', array( $static_pages ), '12.0.0' ); 138 } 139 140 /** 141 * Creates reusable markup for page setup on the Components and Pages dashboard panel. 142 * 143 * @package BuddyPress 144 * @since 1.6.0 145 * @deprecated 12.0.0 146 */ 147 function bp_core_admin_slugs_options() { 148 _deprecated_function( __FUNCTION__, '12.0.0' ); 149 150 do_action_deprecated( 'bp_active_external_directories', array(), '12.0.0' ); 151 do_action_deprecated( 'bp_active_external_pages', array(), '12.0.0' ); 152 } 153 154 /** 155 * Handle saving of the BuddyPress slugs. 156 * 157 * @since 1.6.0 158 * @deprecated 12.0.0 159 */ 160 function bp_core_admin_slugs_setup_handler() { 161 _deprecated_function( __FUNCTION__, '12.0.0' ); 162 } 29 163 } 30 164 … … 67 201 68 202 return apply_filters_deprecated( 'bp_core_component_slug_from_root_slug', array( $root_slug, $root_slug ), '12.0.0' ); 69 }70 71 /**72 * Renders the page mapping admin panel.73 *74 * @since 1.6.075 * @deprecated 12.0.076 */77 function bp_core_admin_slugs_settings() {78 _deprecated_function( __FUNCTION__, '12.0.0' );79 }80 81 /**82 * Generate a list of directory pages, for use when building Components panel markup.83 *84 * @since 2.4.185 * @deprecated 12.0.086 *87 * @return array88 */89 function bp_core_admin_get_directory_pages() {90 _deprecated_function( __FUNCTION__, '12.0.0' );91 92 $directory_pages = (array) bp_core_get_directory_pages();93 $return = wp_list_pluck( $directory_pages, 'name', 'id' );94 95 return apply_filters_deprecated( 'bp_directory_pages', array( $return ), '12.0.0' );96 }97 98 /**99 * Generate a list of static pages, for use when building Components panel markup.100 *101 * By default, this list contains 'register' and 'activate'.102 *103 * @since 2.4.1104 * @deprecated 12.0.0105 *106 * @return array107 */108 function bp_core_admin_get_static_pages() {109 _deprecated_function( __FUNCTION__, '12.0.0' );110 111 $static_pages = array(112 'register' => __( 'Register', 'buddypress' ),113 'activate' => __( 'Activate', 'buddypress' ),114 );115 116 return apply_filters_deprecated( 'bp_directory_pages', array( $static_pages ), '12.0.0' );117 }118 119 /**120 * Creates reusable markup for page setup on the Components and Pages dashboard panel.121 *122 * @package BuddyPress123 * @since 1.6.0124 * @deprecated 12.0.0125 */126 function bp_core_admin_slugs_options() {127 _deprecated_function( __FUNCTION__, '12.0.0' );128 129 do_action_deprecated( 'bp_active_external_directories', array(), '12.0.0' );130 do_action_deprecated( 'bp_active_external_pages', array(), '12.0.0' );131 }132 133 /**134 * Handle saving of the BuddyPress slugs.135 *136 * @since 1.6.0137 * @deprecated 12.0.0138 */139 function bp_core_admin_slugs_setup_handler() {140 _deprecated_function( __FUNCTION__, '12.0.0' );141 203 } 142 204 … … 297 359 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_displayed_user_url()' ); 298 360 bp_displayed_user_url(); 361 } 362 363 /** 364 * Output group directory permalink. 365 * 366 * @since 1.5.0 367 * @deprecated 12.0.0 368 */ 369 function bp_groups_directory_permalink() { 370 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_groups_directory_url()' ); 371 bp_groups_directory_url(); 372 } 373 374 /** 375 * Return group directory permalink. 376 * 377 * @since 1.5.0 378 * @deprecated 12.0.0 379 * 380 * @return string 381 */ 382 function bp_get_groups_directory_permalink() { 383 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_groups_directory_url()' ); 384 385 $url = bp_get_groups_directory_url(); 386 387 /** 388 * Filters the group directory permalink. 389 * 390 * @since 1.5.0 391 * @deprecated 12.0.0 392 * 393 * @param string $url Permalink for the group directory. 394 */ 395 return apply_filters_deprecated( 'bp_get_groups_directory_permalink', array( $url ), '12.0.0', 'bp_get_groups_directory_url' ); 299 396 } 300 397 -
trunk/src/bp-groups/actions/create.php
r13437 r13449 31 31 } 32 32 33 $bp = buddypress(); 33 $bp = buddypress(); 34 $redirect_url = bp_groups_get_create_url(); 34 35 35 36 // Make sure creation steps are in the right order. … … 45 46 setcookie( 'bp_completed_create_steps', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 46 47 47 $reset_steps = true; 48 $keys = array_keys( $bp->groups->group_creation_steps ); 49 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . array_shift( $keys ) ) ); 48 $reset_steps = true; 49 $keys = array_keys( $bp->groups->group_creation_steps ); 50 $action_variable = array_shift( $keys ); 51 bp_core_redirect( bp_groups_get_create_url( array( $action_variable ) ) ); 50 52 } 51 53 … … 53 55 if ( bp_get_groups_current_create_step() && empty( $bp->groups->group_creation_steps[bp_get_groups_current_create_step()] ) ) { 54 56 bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' ); 55 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create' ));57 bp_core_redirect( $redirect_url ); 56 58 } 57 59 … … 67 69 if ( ! bp_is_group_creator( $bp->groups->current_group, bp_loggedin_user_id() ) ) { 68 70 bp_core_add_message( __( 'Only the group creator may continue editing this group.', 'buddypress' ), 'error' ); 69 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create' ));71 bp_core_redirect( $redirect_url ); 70 72 } 71 73 } … … 80 82 if ( empty( $_POST['group-name'] ) || empty( $_POST['group-desc'] ) || !strlen( trim( $_POST['group-name'] ) ) || !strlen( trim( $_POST['group-desc'] ) ) ) { 81 83 bp_core_add_message( __( 'Please fill in all of the required fields', 'buddypress' ), 'error' ); 82 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );84 bp_core_redirect( bp_groups_get_create_url( array( bp_get_groups_current_create_step() ) ) ); 83 85 } 84 86 85 87 $new_group_id = isset( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : 0; 86 88 87 if ( ! $bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) {89 if ( ! $bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) { 88 90 bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' ); 89 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );91 bp_core_redirect( bp_groups_get_create_url( array( bp_get_groups_current_create_step() ) ) ); 90 92 } 91 93 } … … 104 106 $group_status = 'hidden'; 105 107 106 if ( ! $bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) {108 if ( ! $bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) { 107 109 bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' ); 108 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );110 bp_core_redirect( bp_groups_get_create_url( array( bp_get_groups_current_create_step() ) ) ); 109 111 } 110 112 … … 219 221 } 220 222 221 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . $next_step ) ); 223 $redirect_url = bp_get_groups_directory_url( bp_groups_get_path_chunks( array( $next_step ), 'create' ) ); 224 bp_core_redirect( $redirect_url ); 222 225 } 223 226 } … … 238 241 239 242 bp_core_add_message( $message, $error ); 240 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/group-invites') );243 bp_core_redirect( bp_groups_get_create_url( array( 'group-invites' ) ) ); 241 244 } 242 245 -
trunk/src/bp-groups/bp-groups-admin.php
r13437 r13449 637 637 638 638 // Construct URL for form. 639 $form_url = remove_query_arg( array( 'action', 'deleted', 'no_admins', 'error', 'error_new', 'success_new', 'error_modified', 'success_modified' ), $_SERVER['REQUEST_URI'] ); 640 $form_url = add_query_arg( 'action', 'save', $form_url ); 641 $create_url = bp_get_groups_directory_url( 642 array( 643 'create_single_item' => 1, 644 ) 645 ); 639 $form_url = remove_query_arg( array( 'action', 'deleted', 'no_admins', 'error', 'error_new', 'success_new', 'error_modified', 'success_modified' ), $_SERVER['REQUEST_URI'] ); 640 $form_url = add_query_arg( 'action', 'save', $form_url ); 641 $create_url = bp_groups_get_create_url(); 646 642 647 643 /** … … 819 815 // Prepare the group items for display. 820 816 $bp_groups_list_table->prepare_items(); 821 $create_url = bp_get_groups_directory_url( 822 array( 823 'create_single_item' => 1, 824 ) 825 ); 817 $create_url = bp_groups_get_create_url(); 826 818 827 819 /** -
trunk/src/bp-groups/bp-groups-functions.php
r13446 r13449 4015 4015 } 4016 4016 4017 $key_action_variables = 'single_item_action_variables'; 4018 if ( 'create' === $context ) { 4019 $path_chunks['create_single_item'] = 1; 4020 $key_action_variables = 'create_single_item_variables'; 4021 4022 // Init create action variables with the `step` slug. 4023 $path_chunks[ $key_action_variables ][] = bp_rewrites_get_slug( 'groups', 'bp_group_create_step', 'step' ); 4024 } 4025 4017 4026 if ( $chunks ) { 4018 4027 foreach ( $chunks as $chunk ) { 4019 4028 if ( is_numeric( $chunk ) ) { 4020 $path_chunks[ 'single_item_action_variables'][] = $chunk;4029 $path_chunks[ $key_action_variables ][] = $chunk; 4021 4030 } else { 4022 4031 if ( isset( $group_screens[ $chunk ]['rewrite_id'] ) ) { 4023 $item_action_variable_rewrite_id 4024 $path_chunks[ 'single_item_action_variables'][] = bp_rewrites_get_slug( 'groups', $item_action_variable_rewrite_id, $chunk );4032 $item_action_variable_rewrite_id = $group_screens[ $chunk ]['rewrite_id']; 4033 $path_chunks[ $key_action_variables ][] = bp_rewrites_get_slug( 'groups', $item_action_variable_rewrite_id, $chunk ); 4025 4034 } else { 4026 $path_chunks[ 'single_item_action_variables'][] = $chunk;4035 $path_chunks[ $key_action_variables ][] = $chunk; 4027 4036 } 4028 4037 } -
trunk/src/bp-groups/bp-groups-template.php
r13446 r13449 146 146 147 147 /** 148 * Output group directory permalink. 149 * 150 * @since 1.5.0 151 * @deprecated 12.0.0 152 */ 153 function bp_groups_directory_permalink() { 154 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_groups_directory_url()' ); 155 bp_groups_directory_url(); 156 } 157 /** 158 * Return group directory permalink. 159 * 160 * @since 1.5.0 161 * @deprecated 12.0.0 162 * 163 * @return string 164 */ 165 function bp_get_groups_directory_permalink() { 166 /* 167 * This function is used at many places and we need to review all this 168 * places during the 12.0 development cycle. Using BP Rewrites means we 169 * cannot concatenate URL chunks to build our URL anymore. We now need 170 * to use `bp_get_groups_directory_url( $array )` and make sure to use 171 * the right arguments inside this `$array`. Morevover as this function 172 * is also used to build a single group URL, we need to create a new 173 * function to create single group URLs using BP Rewrites. 174 * 175 * @todo Once every link reviewed, we'll be able to remove this check 176 * and let PHPUnit tell us the one we forgot, eventually! 177 */ 178 if ( ! buddypress()->is_phpunit_running ) { 179 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_groups_directory_url()' ); 180 } 181 182 $url = bp_get_groups_directory_url(); 183 184 /** 185 * Filters the group directory permalink. 186 * 187 * @since 1.5.0 188 * @deprecated 12.0.0 189 * 190 * @param string $url Permalink for the group directory. 191 */ 192 return apply_filters_deprecated( 'bp_get_groups_directory_permalink', array( $url ), '12.0.0', 'bp_get_groups_directory_url' ); 193 } 148 * Returns a group create URL accoding to requested path chunks. 149 * 150 * @since 12.0.0 151 * 152 * @param array $chunks array A list of create action variables. 153 * @return string The group create URL. 154 */ 155 function bp_groups_get_create_url( $action_variables = array() ) { 156 $path_chunks = array(); 157 158 if ( is_array( $action_variables ) && $action_variables ) { 159 $path_chunks = bp_groups_get_path_chunks( $action_variables, 'create' ); 160 } else { 161 $path_chunks = array( 162 'create_single_item' => 1, 163 ); 164 } 165 166 return bp_get_groups_directory_url( $path_chunks ); 167 } 194 168 195 169 /** … … 227 201 } 228 202 203 $url = bp_get_groups_directory_url( 204 array( 205 'directory_type' => $type->directory_slug, 206 ) 207 ); 208 229 209 /** 230 210 * Filters the group type directory permalink. … … 232 212 * @since 2.7.0 233 213 * 234 * @param string $ valueGroup type directory permalink.214 * @param string $url Group type directory permalink. 235 215 * @param object $type Group type object. 236 216 * @param string $member_type Group type name, as passed to the function. 237 217 */ 238 return apply_filters( 'bp_get_group_type_directory_permalink', trailingslashit( bp_get_groups_directory_permalink() . bp_get_groups_group_type_base() . '/' . $type->directory_slug ), $type, $group_type );218 return apply_filters( 'bp_get_group_type_directory_permalink', $url, $type, $group_type ); 239 219 } 240 220 … … 1274 1254 $slug = groups_get_slug( $group ); 1275 1255 1276 if ( $group instanceof BP_Groups_Group ) {1256 if ( $group instanceof BP_Groups_Group || ( is_object( $group ) && isset( $group->id, $group->name, $group->slug ) ) ) { 1277 1257 $group_id = (int) $group->id; 1278 1258 } else { … … 3974 3954 'link_text' => __( 'Create a Group', 'buddypress' ), 3975 3955 'link_class' => 'group-create no-ajax', 3976 'link_href' => bp_get_groups_directory_url( 3977 array( 3978 'create_single_item' => 1, 3979 ) 3980 ), 3956 'link_href' => bp_groups_get_create_url(), 3981 3957 'wrapper' => false, 3982 3958 'block_self' => false, … … 5069 5045 5070 5046 if ( $is_enabled && isset( $create_steps[ $create_step ]['rewrite_id'], $create_steps[ $create_step ]['default_slug'] ) ) { 5071 $create_step_slug = bp_rewrites_get_slug( 'groups', 'bp_group_create_step', 'step' ); 5072 $step_slug = bp_rewrites_get_slug( 'groups', $create_steps[ $create_step ]['rewrite_id'], $create_steps[ $create_step ]['default_slug'] ); 5073 $url = bp_get_groups_directory_url( 5074 array( 5075 'create_single_item' => 1, 5076 'create_single_item_variables' => array( $create_step_slug, $step_slug ), 5077 ) 5078 ); 5047 $url = bp_groups_get_create_url( array( $create_steps[ $create_step ]['default_slug'] ) ); 5079 5048 5080 5049 $step_name = sprintf( '<a href="%1$s">%2$s. %3$s</a>', esc_url( $url ), absint( $counter ), esc_html( $step_name ) ); … … 5137 5106 $create_step = bp_action_variable( 1 ); 5138 5107 if ( $create_step && isset( $create_steps[ $create_step ]['rewrite_id'], $create_steps[ $create_step ]['default_slug'] ) ) { 5139 $create_step_slug = bp_rewrites_get_slug( 'groups', 'bp_group_create_step', 'step' ); 5140 $step_slug = bp_rewrites_get_slug( 'groups', $create_steps[ $create_step ]['rewrite_id'], $create_steps[ $create_step ]['default_slug'] ); 5141 5142 $url = bp_get_groups_directory_url( 5143 array( 5144 'create_single_item' => 1, 5145 'create_single_item_variables' => array( $create_step_slug, $step_slug ), 5146 ) 5147 ); 5108 $url = bp_groups_get_create_url( array( $create_steps[ $create_step ]['default_slug'] ) ); 5148 5109 } 5149 5110 … … 5505 5466 5506 5467 if ( isset( $create_steps[ $previous_step ]['rewrite_id'], $create_steps[ $previous_step ]['default_slug'] ) ) { 5507 $create_step_slug = bp_rewrites_get_slug( 'groups', 'bp_group_create_step', 'step' ); 5508 $previous_step = bp_rewrites_get_slug( 'groups', $create_steps[ $previous_step ]['rewrite_id'], $create_steps[ $previous_step ]['default_slug'] ); 5509 5510 $url = bp_get_groups_directory_url( 5511 array( 5512 'create_single_item' => 1, 5513 'create_single_item_variables' => array( $create_step_slug, $previous_step ), 5514 ) 5515 ); 5468 $url = bp_groups_get_create_url( array( $create_steps[ $previous_step ]['default_slug'] ) ); 5516 5469 } 5517 5470 … … 6488 6441 6489 6442 if ( bp_is_current_action( 'create' ) ) { 6490 $uninvite_url = bp_get_groups_directory_permalink() . 'create/step/group-invites/?user_id=' . $user_id; 6443 $uninvite_url = add_query_arg( 6444 'user_id', 6445 $user_id, 6446 bp_get_groups_directory_url( bp_groups_get_path_chunks( array( 'group-invites' ), 'create' ) ) 6447 ); 6491 6448 } else { 6492 6449 $uninvite_url = bp_get_group_url( -
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r13446 r13449 1424 1424 1425 1425 if ( bp_is_current_action( 'create' ) ) { 1426 $uninvite_url = bp_get_groups_directory_permalink() . 'create/step/group-invites/?user_id=' . $friend_id; 1426 $uninvite_url = add_query_arg( 1427 'user_id', 1428 $user_id, 1429 bp_get_groups_directory_url( bp_groups_get_path_chunks( array( 'group-invites' ), 'create' ) ) 1430 ); 1427 1431 } else { 1428 1432 $path_chunks = bp_groups_get_path_chunks( array( 'send-invites', 'remove', $friend_id ) ); -
trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php
r13443 r13449 594 594 'slug' => 'create', // slug is used because BP_Core_Nav requires it, but it's the scope 595 595 'li_class' => array( 'no-ajax', 'group-create', 'create-button' ), 596 'link' => bp_get_groups_directory_url( 597 array( 598 'create_single_item' => 1, 599 ) 600 ), 596 'link' => bp_groups_get_create_url(), 601 597 'text' => __( 'Create a Group', 'buddypress' ), 602 598 'count' => false, -
trunk/tests/phpunit/testcases/core/nav/bpCoreNewSubnavItem.php
r13441 r13449 224 224 'slug' => 'bar', 225 225 'parent_slug' => 'foo', 226 'parent_url' => bp_get_root_ domain() . 'foo/',227 'screen_function' => 'foo', 228 ) ); 229 230 $expected = bp_get_root_ domain() . 'foo/bar/';226 'parent_url' => bp_get_root_url() . 'foo/', 227 'screen_function' => 'foo', 228 ) ); 229 230 $expected = bp_get_root_url() . 'foo/bar/'; 231 231 $this->assertSame( $expected, buddypress()->bp_options_nav['foo']['bar']['link'] ); 232 232 } … … 240 240 'name' => 'foo', 241 241 'slug' => 'foo-parent', 242 'link' => bp_get_root_ domain() . 'foo-parent/',242 'link' => bp_get_root_url() . 'foo-parent/', 243 243 'default_subnav_slug' => 'bar', 244 244 'screen_function' => 'foo', … … 249 249 'slug' => 'bar', 250 250 'parent_slug' => 'foo-parent', 251 'parent_url' => bp_get_root_ domain() . '/foo-parent/',251 'parent_url' => bp_get_root_url() . '/foo-parent/', 252 252 'screen_function' => 'bar', 253 253 ) ); 254 254 255 $expected = bp_get_root_ domain() . '/foo-parent/bar/';255 $expected = bp_get_root_url() . '/foo-parent/bar/'; 256 256 $this->assertSame( $expected, buddypress()->bp_options_nav['foo-parent']['bar']['link'] ); 257 257 } … … 296 296 'slug' => 'foo', 297 297 'parent_slug' => 'parent', 298 'parent_url' => bp_get_root_ domain() . '/parent/',298 'parent_url' => bp_get_root_url() . '/parent/', 299 299 'screen_function' => 'foo', 300 300 'site_admin_only' => true, … … 318 318 'slug' => 'foo', 319 319 'parent_slug' => 'parent', 320 'parent_url' => bp_get_root_ domain() . '/parent/',320 'parent_url' => bp_get_root_url() . '/parent/', 321 321 'screen_function' => 'foo', 322 322 ); … … 340 340 'slug' => 'foo', 341 341 'parent_slug' => 'parent', 342 'parent_url' => bp_get_root_ domain() . '/parent/',342 'parent_url' => bp_get_root_url() . '/parent/', 343 343 'screen_function' => 'foo', 344 344 'item_css_id' => 'bar', -
trunk/tests/phpunit/testcases/routing/groups.php
r13448 r13449 56 56 $this->set_permalink_structure( '/%postname%/' ); 57 57 bp_groups_register_group_type( 'foo' ); 58 $this->go_to( bp_get_groups_directory_permalink() . 'type/foo/' ); 58 $this->go_to( 59 bp_get_groups_directory_url( 60 array( 61 'directory_type' => 'foo', 62 ) 63 ) 64 ); 59 65 $this->assertTrue( bp_is_groups_component() && ! bp_is_group() && bp_is_current_action( bp_get_groups_group_type_base() ) && bp_is_action_variable( 'foo', 0 ) ); 60 66 } … … 66 72 $this->set_permalink_structure( '/%postname%/' ); 67 73 bp_groups_register_group_type( 'foo', array( 'has_directory' => 'foos' ) ); 68 $this->go_to( bp_get_groups_directory_permalink() . 'type/foos/' ); 74 $this->go_to( 75 bp_get_groups_directory_url( 76 array( 77 'directory_type' => 'foos', 78 ) 79 ) 80 ); 69 81 $this->assertTrue( bp_is_groups_component() && ! bp_is_group() && bp_is_current_action( bp_get_groups_group_type_base() ) && bp_is_action_variable( 'foos', 0 ) ); 70 82 } … … 76 88 $this->set_permalink_structure( '/%postname%/' ); 77 89 bp_groups_register_group_type( 'taz', array( 'has_directory' => false ) ); 78 $this->go_to( bp_get_groups_directory_permalink() . 'type/taz/' ); 90 $this->go_to( 91 bp_get_groups_directory_url( 92 array( 93 'directory_type' => 'taz', 94 ) 95 ) 96 ); 79 97 $this->assertEmpty( bp_get_current_group_directory_type() ); 80 98 } … … 85 103 public function test_group_directory_should_404_for_invalid_group_types() { 86 104 $this->set_permalink_structure( '/%postname%/' ); 87 $this->go_to( bp_get_groups_directory_permalink() . 'type/zat/' ); 105 $this->go_to( 106 bp_get_groups_directory_url( 107 array( 108 'directory_type' => 'zat', 109 ) 110 ) 111 ); 88 112 $this->assertEmpty( bp_get_current_group_directory_type() ); 89 113 } … … 94 118 public function test_group_previous_slug_current_slug_should_resolve() { 95 119 $this->set_permalink_structure( '/%postname%/' ); 96 $g1 = self::factory()->group->create( array( 97 'slug' => 'george', 98 ) ); 99 groups_edit_base_group_details( array( 100 'group_id' => $g1, 101 'slug' => 'ralph', 102 ) ); 103 104 $this->go_to( bp_get_groups_directory_permalink() . 'ralph' ); 105 120 $g1 = self::factory()->group->create( 121 array( 122 'slug' => 'george', 123 ) 124 ); 125 126 groups_edit_base_group_details( 127 array( 128 'group_id' => $g1, 129 'slug' => 'ralph', 130 ) 131 ); 132 133 $this->go_to( bp_get_group_url( $g1 ) ); 134 $this->assertEquals( groups_get_current_group()->slug, 'ralph' ); 135 } 136 137 /** 138 * @group group_previous_slug 139 */ 140 public function test_group_previous_slug_should_resolve() { 141 $this->set_permalink_structure( '/%postname%/' ); 142 $g1 = self::factory()->group->create( 143 array( 144 'slug' => 'george', 145 ) 146 ); 147 148 groups_edit_base_group_details( 149 array( 150 'group_id' => $g1, 151 'slug' => 'sam!', 152 'notify_members' => false, 153 ) 154 ); 155 156 $url = bp_rewrites_get_url( 157 array( 158 'component_id' => 'groups', 159 'single_item' => 'george', 160 ) 161 ); 162 163 $this->go_to( $url ); 106 164 $this->assertEquals( $g1, bp_get_current_group_id() ); 107 165 } … … 109 167 /** 110 168 * @group group_previous_slug 111 */ 112 public function test_group_previous_slug_should_resolve() { 113 $this->set_permalink_structure( '/%postname%/' ); 114 $g1 = self::factory()->group->create( array( 115 'slug' => 'george', 116 ) ); 117 118 groups_edit_base_group_details( array( 119 'group_id' => $g1, 120 'slug' => 'sam!', 121 'notify_members' => false, 122 ) ); 123 $this->go_to( bp_get_groups_directory_permalink() . 'george' ); 124 125 $this->assertEquals( $g1, bp_get_current_group_id() ); 126 } 127 128 /** 129 * @group group_previous_slug 169 * @group imath 130 170 */ 131 171 public function test_group_previous_slug_most_recent_takes_precedence() { 132 172 $this->set_permalink_structure( '/%postname%/' ); 133 $g1 = self::factory()->group->create( array( 134 'slug' => 'george', 135 ) ); 136 groups_edit_base_group_details( array( 137 'group_id' => $g1, 138 'slug' => 'ralph', 139 'notify_members' => false, 140 ) ); 141 $g2 = self::factory()->group->create( array( 142 'slug' => 'george', 143 ) ); 144 groups_edit_base_group_details( array( 145 'group_id' => $g2, 146 'slug' => 'sam', 147 'notify_members' => false, 148 ) ); 149 150 $this->go_to( bp_get_groups_directory_permalink() . 'george' ); 173 $g1 = self::factory()->group->create( 174 array( 175 'slug' => 'george', 176 ) 177 ); 178 179 groups_edit_base_group_details( 180 array( 181 'group_id' => $g1, 182 'slug' => 'ralph', 183 'notify_members' => false, 184 ) 185 ); 186 187 $g2 = self::factory()->group->create( 188 array( 189 'slug' => 'george', 190 ) 191 ); 192 193 groups_edit_base_group_details( 194 array( 195 'group_id' => $g2, 196 'slug' => 'sam', 197 'notify_members' => false, 198 ) 199 ); 200 201 $url = bp_rewrites_get_url( 202 array( 203 'component_id' => 'groups', 204 'single_item' => 'george', 205 ) 206 ); 207 208 $this->go_to( $url ); 151 209 $this->assertEquals( $g2, bp_get_current_group_id() ); 152 210 }
Note: See TracChangeset
for help on using the changeset viewer.