Changeset 13441
- Timestamp:
- 03/23/2023 07:35:38 PM (23 months ago)
- Location:
- trunk
- Files:
-
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-notifications.php
r13433 r13441 30 30 $user_id = $secondary_item_id; 31 31 $user_fullname = bp_core_get_user_displayname( $user_id ); 32 $activity_slug = bp_get_activity_slug(); 32 33 33 34 switch ( $action ) { 34 35 case 'new_at_mention': 35 36 $action_filter = 'at_mentions'; 36 $link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; 37 $link = bp_loggedin_user_url( 38 array( 39 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ), 40 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_mentions', 'mentions' ), 41 ) 42 ); 37 43 38 44 /* translators: %s: the current user display name */ -
trunk/src/bp-activity/classes/class-bp-activity-activity.php
r13414 r13441 300 300 301 301 if ( empty( $this->primary_link ) ) { 302 $this->primary_link = bp_loggedin_user_ domain();302 $this->primary_link = bp_loggedin_user_url(); 303 303 } 304 304 -
trunk/src/bp-activity/classes/class-bp-activity-component.php
r13432 r13441 255 255 } 256 256 257 // Determine user to use. 258 if ( bp_displayed_user_domain() ) { 259 $user_domain = bp_displayed_user_domain(); 260 } elseif ( bp_loggedin_user_domain() ) { 261 $user_domain = bp_loggedin_user_domain(); 262 } else { 263 return; 264 } 265 266 $slug = bp_get_activity_slug(); 267 $activity_link = trailingslashit( $user_domain . $slug ); 257 $slug = bp_get_activity_slug(); 268 258 269 259 // Add 'Activity' to the main navigation. … … 281 271 'name' => _x( 'Personal', 'Profile activity screen sub nav', 'buddypress' ), 282 272 'slug' => 'just-me', 283 'parent_url' => $activity_link,284 273 'parent_slug' => $slug, 285 274 'screen_function' => 'bp_activity_screen_my_activity', … … 292 281 'name' => _x( 'Mentions', 'Profile activity screen sub nav', 'buddypress' ), 293 282 'slug' => 'mentions', 294 'parent_url' => $activity_link,295 283 'parent_slug' => $slug, 296 284 'screen_function' => 'bp_activity_screen_mentions', … … 305 293 'name' => _x( 'Favorites', 'Profile activity screen sub nav', 'buddypress' ), 306 294 'slug' => 'favorites', 307 'parent_url' => $activity_link,308 295 'parent_slug' => $slug, 309 296 'screen_function' => 'bp_activity_screen_favorites', … … 318 305 'name' => _x( 'Friends', 'Profile activity screen sub nav', 'buddypress' ), 319 306 'slug' => bp_get_friends_slug(), 320 'parent_url' => $activity_link,321 307 'parent_slug' => $slug, 322 308 'screen_function' => 'bp_activity_screen_friends', … … 331 317 'name' => _x( 'Groups', 'Profile activity screen sub nav', 'buddypress' ), 332 318 'slug' => bp_get_groups_slug(), 333 'parent_url' => $activity_link,334 319 'parent_slug' => $slug, 335 320 'screen_function' => 'bp_activity_screen_groups', … … 359 344 360 345 // Setup the logged in user variables. 361 $activity_link = trailingslashit( bp_loggedin_user_domain() . bp_get_activity_slug() ); 346 $activity_slug = bp_get_activity_slug(); 347 $custom_activity_slug = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ); 362 348 363 349 // Unread message count. … … 380 366 'id' => 'my-account-' . $this->id, 381 367 'title' => _x( 'Activity', 'My Account Activity sub nav', 'buddypress' ), 382 'href' => $activity_link 368 'href' => bp_loggedin_user_url( 369 array( 370 'single_item_component' => $custom_activity_slug, 371 ) 372 ), 383 373 ); 384 374 … … 388 378 'id' => 'my-account-' . $this->id . '-personal', 389 379 'title' => _x( 'Personal', 'My Account Activity sub nav', 'buddypress' ), 390 'href' => trailingslashit( $activity_link . 'just-me' ), 391 'position' => 10 380 'href' => bp_loggedin_user_url( 381 array( 382 'single_item_component' => $custom_activity_slug, 383 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_just_me', 'just-me' ), 384 ) 385 ), 386 'position' => 10, 392 387 ); 393 388 … … 398 393 'id' => 'my-account-' . $this->id . '-mentions', 399 394 'title' => $title, 400 'href' => trailingslashit( $activity_link . 'mentions' ), 401 'position' => 20 395 'href' => bp_loggedin_user_url( 396 array( 397 'single_item_component' => $custom_activity_slug, 398 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_mentions', 'mentions' ), 399 ) 400 ), 401 'position' => 20, 402 402 ); 403 403 } … … 409 409 'id' => 'my-account-' . $this->id . '-favorites', 410 410 'title' => _x( 'Favorites', 'My Account Activity sub nav', 'buddypress' ), 411 'href' => trailingslashit( $activity_link . 'favorites' ), 412 'position' => 30 411 'href' => bp_loggedin_user_url( 412 array( 413 'single_item_component' => $custom_activity_slug, 414 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ), 415 ) 416 ), 417 'position' => 30, 413 418 ); 414 419 } … … 416 421 // Friends? 417 422 if ( bp_is_active( 'friends' ) ) { 423 $friends_slug = bp_get_friends_slug(); 418 424 $wp_admin_nav[] = array( 419 425 'parent' => 'my-account-' . $this->id, 420 426 'id' => 'my-account-' . $this->id . '-friends', 421 427 'title' => _x( 'Friends', 'My Account Activity sub nav', 'buddypress' ), 422 'href' => trailingslashit( $activity_link . bp_get_friends_slug() ), 423 'position' => 40 428 'href' => bp_loggedin_user_url( 429 array( 430 'single_item_component' => $custom_activity_slug, 431 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_' . $friends_slug, $friends_slug ), 432 ) 433 ), 434 'position' => 40, 424 435 ); 425 436 } … … 427 438 // Groups? 428 439 if ( bp_is_active( 'groups' ) ) { 440 $groups_slug = bp_get_groups_slug(); 429 441 $wp_admin_nav[] = array( 430 442 'parent' => 'my-account-' . $this->id, 431 443 'id' => 'my-account-' . $this->id . '-groups', 432 444 'title' => _x( 'Groups', 'My Account Activity sub nav', 'buddypress' ), 433 'href' => trailingslashit( $activity_link . bp_get_groups_slug() ), 445 'href' => bp_loggedin_user_url( 446 array( 447 'single_item_component' => $custom_activity_slug, 448 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_' . $groups_slug, $groups_slug ), 449 ) 450 ), 434 451 'position' => 50 435 452 ); -
trunk/src/bp-activity/screens/permalink.php
r13436 r13441 154 154 } else { 155 155 bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' ); 156 bp_core_redirect( bp_loggedin_user_ domain() );156 bp_core_redirect( bp_loggedin_user_url() ); 157 157 } 158 158 } -
trunk/src/bp-blogs/classes/class-bp-blogs-component.php
r13436 r13441 219 219 } 220 220 221 // Determine user to use. 222 if ( bp_displayed_user_domain() ) { 223 $user_domain = bp_displayed_user_domain(); 224 } elseif ( bp_loggedin_user_domain() ) { 225 $user_domain = bp_loggedin_user_domain(); 226 } else { 221 // Stop if there is no user displayed or logged in. 222 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 227 223 return; 228 224 } 229 225 230 226 $slug = bp_get_blogs_slug(); 231 $parent_url = trailingslashit( $user_domain . $slug );232 227 233 228 // Add 'Sites' to the main navigation. … … 255 250 'name' => __( 'My Sites', 'buddypress' ), 256 251 'slug' => 'my-sites', 257 'parent_url' => $parent_url,258 252 'parent_slug' => $slug, 259 253 'screen_function' => 'bp_blogs_screen_my_blogs', … … 290 284 291 285 // Setup the logged in user variables. 292 $blogs_link = trailingslashit( bp_loggedin_user_domain() . bp_get_blogs_slug() ); 286 $blogs_slug = bp_get_blogs_slug(); 287 $custom_blogs_slug = bp_rewrites_get_slug( 'members', 'member_' . $blogs_slug, $blogs_slug ); 293 288 294 289 // Add the "Sites" sub menu. … … 297 292 'id' => 'my-account-' . $this->id, 298 293 'title' => __( 'Sites', 'buddypress' ), 299 'href' => $blogs_link 294 'href' => bp_loggedin_user_url( 295 array( 296 'single_item_component' => $custom_blogs_slug, 297 ) 298 ), 300 299 ); 301 300 … … 305 304 'id' => 'my-account-' . $this->id . '-my-sites', 306 305 'title' => __( 'My Sites', 'buddypress' ), 307 'href' => trailingslashit( $blogs_link . 'my-sites' ), 308 'position' => 10 306 'href' => bp_loggedin_user_url( 307 array( 308 'single_item_component' => $custom_blogs_slug, 309 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $blogs_slug . '_my_sites', 'my-sites' ), 310 ) 311 ), 312 'position' => 10, 309 313 ); 310 314 -
trunk/src/bp-core/bp-core-blocks.php
r13440 r13441 324 324 </a> 325 325 </div>', 326 bp_loggedin_user_ domain(),326 bp_loggedin_user_url(), 327 327 bp_get_loggedin_user_avatar( 328 328 array( -
trunk/src/bp-core/bp-core-buddybar.php
r13436 r13441 161 161 'name' => $r['name'], 162 162 'slug' => $r['slug'], 163 'link' => trailingslashit( bp_loggedin_user_domain() . $r['slug'] ),164 163 'css_id' => $r['item_css_id'], 165 164 'show_for_displayed_user' => $r['show_for_displayed_user'], … … 561 560 562 561 // If we don't have the required info we need, don't create this subnav item. 563 if ( empty( $r['name'] ) || empty( $r['slug'] ) || empty( $r['parent_slug'] ) || empty( $r['parent_url'] ) || empty( $r['screen_function'] ) ) 564 return false; 565 566 // Link was not forced, so create one. 567 if ( empty( $r['link'] ) ) { 562 if ( empty( $r['name'] ) || empty( $r['slug'] ) || empty( $r['parent_slug'] ) || empty( $r['screen_function'] ) ) { 563 return false; 564 } 565 566 // Preserve backward compatibility for plugins forcing URLs. 567 if ( empty( $r['link'] ) && ! empty( $r['parent_url'] ) ) { 568 568 $r['link'] = trailingslashit( $r['parent_url'] . $r['slug'] ); 569 570 $parent_nav = $bp->{$component}->nav->get_primary( array( 'slug' => $r['parent_slug'] ), false );571 572 // If this sub item is the default for its parent, skip the slug.573 if ( $parent_nav ) {574 $parent_nav_item = reset( $parent_nav );575 if ( ! empty( $parent_nav_item->default_subnav_slug ) && $r['slug'] === $parent_nav_item->default_subnav_slug ) {576 $r['link'] = trailingslashit( $r['parent_url'] );577 }578 }579 569 } 580 570 … … 601 591 ); 602 592 593 // Add the item to the subnav. 603 594 buddypress()->{$component}->nav->add_nav( $subnav_item ); 604 595 -
trunk/src/bp-core/bp-core-functions.php
r13436 r13441 2588 2588 bp_core_redirect( apply_filters( 'bp_core_search_site', home_url( $slug . $query_string . urlencode( $search_terms ) ), $search_terms ) ); 2589 2589 } 2590 add_action( 'bp_ init', 'bp_core_action_search_site', 7);2590 add_action( 'bp_parse_query', 'bp_core_action_search_site', 13, 0 ); 2591 2591 2592 2592 /** -
trunk/src/bp-core/bp-core-rewrites.php
r13436 r13441 119 119 */ 120 120 function bp_rewrites_get_url( $args = array() ) { 121 $bp 121 $bp = buddypress(); 122 122 $url = get_home_url( bp_get_root_blog_id() ); 123 123 … … 159 159 // Using pretty URLs. 160 160 } else { 161 if ( ! isset( $component->rewrite_ids['directory'] ) || ! isset( $component->directory_permastruct ) ) { 161 if ( isset( $component->rewrite_ids['directory'] ) && isset( $component->directory_permastruct ) ) { 162 if ( isset( $r['member_register'] ) ) { 163 $url = str_replace( '%' . $component->rewrite_ids['member_register'] . '%', '', $component->register_permastruct ); 164 unset( $r['member_register'] ); 165 } elseif ( isset( $r['member_activate'] ) ) { 166 $url = str_replace( '%' . $component->rewrite_ids['member_activate'] . '%', '', $component->activate_permastruct ); 167 unset( $r['member_activate'] ); 168 } elseif ( isset( $r['create_single_item'] ) ) { 169 $create_slug = 'create'; 170 if ( 'groups' === $component->id ) { 171 $create_slug = bp_rewrites_get_slug( 'groups', 'group_create', 'create' ); 172 } elseif ( 'blogs' === $component->id ) { 173 $create_slug = bp_rewrites_get_slug( 'blogs', 'blog_create', 'create' ); 174 } 175 176 $url = str_replace( '%' . $component->rewrite_ids['directory'] . '%', $create_slug, $component->directory_permastruct ); 177 unset( $r['create_single_item'] ); 178 } else { 179 $url = str_replace( '%' . $component->rewrite_ids['directory'] . '%', $r['single_item'], $component->directory_permastruct ); 180 181 // Remove the members directory slug when root profiles are on. 182 if ( bp_core_enable_root_profiles() && 'members' === $component->id && isset( $r['single_item'] ) && $r['single_item'] ) { 183 $url = str_replace( $bp->members->root_slug . '/', '', $url ); 184 } 185 186 unset( $r['single_item'] ); 187 } 188 189 $r = array_filter( $r ); 190 191 if ( isset( $r['directory_type'] ) && $r['directory_type'] ) { 192 if ( 'members' === $component->id ) { 193 array_unshift( $r, bp_get_members_member_type_base() ); 194 } elseif ( 'groups' === $component->id && bp_is_active( 'groups' ) ) { 195 array_unshift( $r, bp_get_groups_group_type_base() ); 196 } else { 197 unset( $r['directory_type'] ); 198 } 199 } 200 201 if ( isset( $r['single_item_action_variables'] ) && $r['single_item_action_variables'] ) { 202 $r['single_item_action_variables'] = join( '/', (array) $r['single_item_action_variables'] ); 203 } 204 205 if ( isset( $r['create_single_item_variables'] ) && $r['create_single_item_variables'] ) { 206 $r['create_single_item_variables'] = join( '/', (array) $r['create_single_item_variables'] ); 207 } 208 } elseif ( isset( $r['community_search'] ) && 1 === $r['community_search'] ) { 209 $r = array_filter( $r ); 210 $url = ''; 211 212 unset( $r['community_search'] ); 213 array_unshift( $r, bp_get_search_slug() ); 214 } else { 162 215 return $url; 163 }164 165 if ( isset( $r['member_register'] ) ) {166 $url = str_replace( '%' . $component->rewrite_ids['member_register'] . '%', '', $component->register_permastruct );167 unset( $r['member_register'] );168 } elseif ( isset( $r['member_activate'] ) ) {169 $url = str_replace( '%' . $component->rewrite_ids['member_activate'] . '%', '', $component->activate_permastruct );170 unset( $r['member_activate'] );171 } elseif ( isset( $r['create_single_item'] ) ) {172 $create_slug = 'create';173 if ( 'groups' === $component->id ) {174 $create_slug = bp_rewrites_get_slug( 'groups', 'group_create', 'create' );175 } elseif ( 'blogs' === $component->id ) {176 $create_slug = bp_rewrites_get_slug( 'blogs', 'blog_create', 'create' );177 }178 179 $url = str_replace( '%' . $component->rewrite_ids['directory'] . '%', $create_slug, $component->directory_permastruct );180 unset( $r['create_single_item'] );181 } else {182 $url = str_replace( '%' . $component->rewrite_ids['directory'] . '%', $r['single_item'], $component->directory_permastruct );183 184 // Remove the members directory slug when root profiles are on.185 if ( bp_core_enable_root_profiles() && 'members' === $component->id && isset( $r['single_item'] ) && $r['single_item'] ) {186 $url = str_replace( $bp->members->root_slug . '/', '', $url );187 }188 189 unset( $r['single_item'] );190 }191 192 $r = array_filter( $r );193 194 if ( isset( $r['directory_type'] ) && $r['directory_type'] ) {195 if ( 'members' === $component->id ) {196 array_unshift( $r, bp_get_members_member_type_base() );197 } elseif ( 'groups' === $component->id && bp_is_active( 'groups' ) ) {198 array_unshift( $r, bp_get_groups_group_type_base() );199 } else {200 unset( $r['directory_type'] );201 }202 }203 204 if ( isset( $r['single_item_action_variables'] ) && $r['single_item_action_variables'] ) {205 $r['single_item_action_variables'] = join( '/', (array) $r['single_item_action_variables'] );206 }207 208 if ( isset( $r['create_single_item_variables'] ) && $r['create_single_item_variables'] ) {209 $r['create_single_item_variables'] = join( '/', (array) $r['create_single_item_variables'] );210 216 } 211 217 -
trunk/src/bp-core/bp-core-template.php
r13436 r13441 520 520 $url = bp_rewrites_get_url( 521 521 array( 522 'component_id' => bp_get_search_slug(), 522 'component_id' => 'core', 523 'community_search' => 1, 523 524 ) 524 525 ); … … 3643 3644 foreach ( $bp->{$component}->nav->get_item_nav() as $nav_menu ) { 3644 3645 // Get the correct menu link. See https://buddypress.trac.wordpress.org/ticket/4624. 3645 $link = bp_loggedin_user_domain() ? str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $nav_menu->link ) : trailingslashit( bp_displayed_user_domain() . $nav_menu->link ); 3646 $link = $nav_menu->link; 3647 if ( bp_loggedin_user_url() ) { 3648 $link = str_replace( bp_loggedin_user_url(), bp_displayed_user_url(), $nav_menu->link ); 3649 } 3646 3650 3647 3651 // Add this menu. -
trunk/src/bp-core/classes/class-bp-core-login-widget.php
r13108 r13441 77 77 78 78 <div class="bp-login-widget-user-avatar"> 79 <a href="<?php echo bp_loggedin_user_domain(); ?>">79 <a href="<?php bp_loggedin_user_link(); ?>"> 80 80 <?php bp_loggedin_user_avatar( 'type=thumb&width=50&height=50' ); ?> 81 81 </a> -
trunk/src/bp-core/classes/class-bp-core-nav.php
r13108 r13441 36 36 37 37 /** 38 * The component ID. 39 * 40 * @since 12.0.0 41 * @var string 42 */ 43 private $component_id; 44 45 /** 38 46 * Initializes the Nav belonging to the specified object. 39 47 * … … 42 50 * @param int $object_id The item ID to build the nav for. Default is the displayed user ID. 43 51 */ 44 public function __construct( $object_id = 0 ) { 45 if ( empty( $object_id ) ) { 52 public function __construct( $object_id = 0, $component_id = 'members' ) { 53 if ( bp_is_active( $component_id ) ) { 54 $this->component_id = $component_id; 55 } 56 57 if ( empty( $object_id ) && 'members' === $this->component_id ) { 46 58 $this->object_id = (int) bp_displayed_user_id(); 47 59 } else { … … 136 148 } 137 149 150 $path_chunks = array( 151 'component_id' => $this->component_id, 152 ); 153 138 154 // We have a child and the parent exists. 139 155 if ( ! empty( $args['parent_slug'] ) ) { 140 $slug = $args['parent_slug'] . '/' . $args['slug']; 141 $args['secondary'] = true; 156 $slug = $args['parent_slug'] . '/' . $args['slug']; 157 $path_chunks['single_item_component'] = $args['parent_slug']; 158 $path_chunks['single_item_action'] = $args['slug']; 159 $args['secondary'] = true; 142 160 143 161 // This is a parent. 144 162 } else { 145 $slug = $args['slug']; 146 $args['primary'] = true; 163 $slug = $args['slug']; 164 $path_chunks['single_item_component'] = $slug; 165 $args['primary'] = true; 166 } 167 168 /* 169 * This is where we set links using BP Rewrites. 170 * 171 * @since 12.0.0 172 */ 173 if ( ! isset( $args['link'] ) || ! $args['link'] ) { 174 if ( 'groups' === $this->component_id ) { 175 if ( isset( $path_chunks['single_item_component'] ) ) { 176 $path_chunks['single_item'] = str_replace( '_manage', '', $path_chunks['single_item_component'] ); 177 } else { 178 $path_chunks['single_item'] = groups_get_slug( $this->object_id ); 179 } 180 181 $chunk = 'single_item_action'; 182 if ( $path_chunks['single_item'] . '_manage' === $path_chunks['single_item_component'] ) { 183 $chunk = 'single_item_action_variables'; 184 $path_chunks[ $chunk ] = $path_chunks['single_item_action']; 185 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ); 186 $group_screens = bp_get_group_screens( 'manage' ); 187 } else { 188 $group_screens = bp_get_group_screens( 'read' ); 189 } 190 191 if ( isset( $group_screens[ $args['slug'] ] ) ) { 192 $args['rewrite_id'] = $group_screens[ $args['slug'] ]['rewrite_id']; 193 $path_chunks[ $chunk ] = bp_rewrites_get_slug( 'groups', $args['rewrite_id'], $args['slug'] ); 194 195 if ( 'single_item_action_variables' === $chunk ) { 196 $path_chunks[ $chunk ] = array( $path_chunks[ $chunk ] ); 197 } 198 } 199 200 unset( $path_chunks['single_item_component'] ); 201 $args['link'] = bp_rewrites_get_url( $path_chunks ); 202 } else { 203 $path_chunks['single_item_component'] = bp_rewrites_get_slug( 'members', 'member_' . $path_chunks['single_item_component'], $path_chunks['single_item_component'] ); 204 205 if ( isset( $path_chunks['single_item_action'] ) && ! is_numeric( $path_chunks['single_item_action'] ) ) { 206 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 207 'members', 208 'member_' . $path_chunks['single_item_component'] . '_' . $path_chunks['single_item_action'], 209 $path_chunks['single_item_action'] 210 ); 211 } 212 213 $args['link'] = bp_members_get_user_url( $this->object_id, $path_chunks ); 214 } 147 215 } 148 216 -
trunk/src/bp-core/classes/class-bp-core.php
r13432 r13441 292 292 // Is the logged in user is a mod for the current item? 293 293 bp_update_is_item_mod( false, 'core' ); 294 295 /* 296 * As the BP Core component is excluded from the BP Component code 297 * used to set the Rewrite IDs, we need to set it here. As the `search` 298 * word is already a WordPress rewrite tag, we are not adding a custom 299 * rule for this component to avoid messing with it. 300 */ 301 $this->rewrite_ids = array( 302 'community_search' => 'bp_search', 303 ); 294 304 295 305 parent::setup_globals( … … 401 411 402 412 parent::register_post_statuses(); 413 } 414 415 /** 416 * Parse the WP_Query and eventually set the BP Search mechanism. 417 * 418 * Search doesn't have an associated page, so we check for it separately. 419 * 420 * @since 12.0.0 421 * 422 * @param WP_Query $query Required. See BP_Component::parse_query() for 423 * description. 424 */ 425 public function parse_query( $query ) { 426 $is_search = $query->get( 'pagename' ) === bp_get_search_slug() || ( isset( $_GET['bp_search'] ) && 1 === (int) $_GET['bp_search'] ); 427 428 if ( isset( $_POST['search-terms'] ) && $is_search ) { 429 buddypress()->current_component = bp_get_search_slug(); 430 } 431 432 parent::parse_query( $query ); 403 433 } 404 434 -
trunk/src/bp-friends/bp-friends-notifications.php
r13092 r13441 29 29 */ 30 30 function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { 31 $friends_slug = bp_get_friends_slug(); 32 $custom_friends_slug = bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ); 31 33 32 34 switch ( $action ) { 33 35 case 'friendship_accepted': 34 $link = trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends' ); 36 $link = bp_loggedin_user_url( 37 array( 38 'single_item_component' => $custom_friends_slug, 39 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ), 40 ) 41 ); 35 42 36 43 // $action and $amount are used to generate dynamic filter names. … … 51 58 52 59 case 'friendship_request': 53 $link = bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/?new'; 60 $link = add_query_arg( 61 'new', 62 1, 63 bp_loggedin_user_url( 64 array( 65 'single_item_component' => $custom_friends_slug, 66 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 67 ) 68 ) 69 ); 54 70 55 71 $action = 'request'; -
trunk/src/bp-friends/bp-friends-template.php
r13434 r13441 378 378 379 379 $friendship_status = bp_is_friend( $potential_friend_id ); 380 $friends_slug = bp_get_friends_slug(); 381 $custom_friends_slug = bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ); 380 382 381 383 if ( empty( $friendship_status ) ) { … … 392 394 'wrapper_class' => 'friendship-button pending_friend', 393 395 'wrapper_id' => 'friendship-button-' . $potential_friend_id, 394 'link_href' => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $potential_friend_id . '/', 'friends_withdraw_friendship' ), 396 'link_href' => wp_nonce_url( 397 bp_loggedin_user_url( 398 array( 399 'single_item_component' => $custom_friends_slug, 400 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 401 'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests_cancel', 'cancel' ), $potential_friend_id ), 402 ) 403 ), 404 'friends_withdraw_friendship' 405 ), 395 406 'link_text' => __( 'Cancel Friendship Request', 'buddypress' ), 396 407 'link_title' => __( 'Cancel Friendship Requested', 'buddypress' ), … … 409 420 'wrapper_class' => 'friendship-button awaiting_response_friend', 410 421 'wrapper_id' => 'friendship-button-' . $potential_friend_id, 411 'link_href' => bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/', 422 'link_href' => bp_loggedin_user_url( 423 array( 424 'single_item_component' => $custom_friends_slug, 425 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 426 ) 427 ), 412 428 'link_text' => __( 'Friendship Requested', 'buddypress' ), 413 429 'link_title' => __( 'Friendship Requested', 'buddypress' ), … … 426 442 'wrapper_class' => 'friendship-button is_friend', 427 443 'wrapper_id' => 'friendship-button-' . $potential_friend_id, 428 'link_href' => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/remove-friend/' . $potential_friend_id . '/', 'friends_remove_friend' ), 444 'link_href' => wp_nonce_url( 445 bp_loggedin_user_url( 446 array( 447 'single_item_component' => $custom_friends_slug, 448 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_remove_friend', 'remove-friend' ), 449 'single_item_action_variables' => array( $potential_friend_id ), 450 ) 451 ), 452 'friends_remove_friend' 453 ), 429 454 'link_text' => __( 'Cancel Friendship', 'buddypress' ), 430 455 'link_title' => __( 'Cancel Friendship', 'buddypress' ), … … 443 468 'wrapper_class' => 'friendship-button not_friends', 444 469 'wrapper_id' => 'friendship-button-' . $potential_friend_id, 445 'link_href' => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $potential_friend_id . '/', 'friends_add_friend' ), 470 'link_href' => wp_nonce_url( 471 bp_loggedin_user_url( 472 array( 473 'single_item_component' => $custom_friends_slug, 474 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_add_friend', 'add-friend' ), 475 'single_item_action_variables' => array( $potential_friend_id ), 476 ) 477 ), 478 'friends_add_friend' 479 ), 446 480 'link_text' => __( 'Add Friend', 'buddypress' ), 447 481 'link_title' => __( 'Add Friend', 'buddypress' ), … … 610 644 } 611 645 646 $friends_slug = bp_get_friends_slug(); 647 $url = wp_nonce_url( 648 bp_loggedin_user_url( 649 array( 650 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ), 651 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 652 'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests_accept', 'accept' ), $friendship_id ), 653 ) 654 ), 655 'friends_accept_friendship' 656 ); 657 612 658 /** 613 659 * Filters the URL for accepting the current friendship request in the loop. … … 616 662 * @since 2.6.0 Added the `$friendship_id` parameter. 617 663 * 618 * @param string $ valueAccept-friendship URL.664 * @param string $url Accept-friendship URL. 619 665 * @param int $friendship_id ID of the friendship. 620 666 */ 621 return apply_filters( 'bp_get_friend_accept_request_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/accept/' . $friendship_id ), 'friends_accept_friendship' ), $friendship_id );667 return apply_filters( 'bp_get_friend_accept_request_link', $url, $friendship_id ); 622 668 } 623 669 … … 647 693 } 648 694 695 $friends_slug = bp_get_friends_slug(); 696 $url = wp_nonce_url( 697 bp_loggedin_user_url( 698 array( 699 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ), 700 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 701 'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests_reject', 'reject' ), $friendship_id ), 702 ) 703 ), 704 'friends_reject_friendship' 705 ); 706 649 707 /** 650 708 * Filters the URL for rejecting the current friendship request in the loop. … … 653 711 * @since 2.6.0 Added the `$friendship_id` parameter. 654 712 * 655 * @param string $ valueReject-friendship URL.713 * @param string $url Reject-friendship URL. 656 714 * @param int $friendship_id ID of the friendship. 657 715 */ 658 return apply_filters( 'bp_get_friend_reject_request_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/reject/' . $friendship_id ), 'friends_reject_friendship' ), $friendship_id );716 return apply_filters( 'bp_get_friend_reject_request_link', $url, $friendship_id ); 659 717 } 660 718 -
trunk/src/bp-friends/classes/class-bp-friends-component.php
r13432 r13441 162 162 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 163 163 164 // Determine user to use. 165 if ( bp_displayed_user_domain() ) { 166 $user_domain = bp_displayed_user_domain(); 167 } elseif ( bp_loggedin_user_domain() ) { 168 $user_domain = bp_loggedin_user_domain(); 169 } else { 164 // Stop if there is no user displayed or logged in. 165 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 170 166 return; 171 167 } 172 168 173 $access = bp_core_can_edit_settings(); 174 $slug = bp_get_friends_slug(); 175 $friends_link = trailingslashit( $user_domain . $slug ); 169 $access = bp_core_can_edit_settings(); 170 $slug = bp_get_friends_slug(); 176 171 177 172 // Add 'Friends' to the main navigation. … … 202 197 'name' => _x( 'Friendships', 'Friends screen sub nav', 'buddypress' ), 203 198 'slug' => 'my-friends', 204 'parent_url' => $friends_link,205 199 'parent_slug' => $slug, 206 200 'screen_function' => 'friends_screen_my_friends', … … 212 206 'name' => _x( 'Requests', 'Friends screen sub nav', 'buddypress' ), 213 207 'slug' => 'requests', 214 'parent_url' => $friends_link,215 208 'parent_slug' => $slug, 216 209 'screen_function' => 'friends_screen_requests', … … 238 231 239 232 // Setup the logged in user variables. 240 $friends_link = trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() ); 233 $friends_slug = bp_get_friends_slug(); 234 $custom_friends_slug = bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ); 241 235 242 236 // Pending friend requests. … … 263 257 'id' => 'my-account-' . $this->id, 264 258 'title' => $title, 265 'href' => $friends_link, 259 'href' => bp_loggedin_user_url( 260 array( 261 'single_item_component' => $custom_friends_slug, 262 ) 263 ), 266 264 ); 267 265 … … 271 269 'id' => 'my-account-' . $this->id . '-friendships', 272 270 'title' => _x( 'Friendships', 'My Account Friends menu sub nav', 'buddypress' ), 273 'href' => trailingslashit( $friends_link . 'my-friends' ), 271 'href' => bp_loggedin_user_url( 272 array( 273 'single_item_component' => $custom_friends_slug, 274 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ), 275 ) 276 ), 274 277 'position' => 10, 275 278 ); … … 280 283 'id' => 'my-account-' . $this->id . '-requests', 281 284 'title' => $pending, 282 'href' => trailingslashit( $friends_link . 'requests' ), 285 'href' => bp_loggedin_user_url( 286 array( 287 'single_item_component' => $custom_friends_slug, 288 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 289 ) 290 ), 283 291 'position' => 20, 284 292 ); -
trunk/src/bp-friends/screens/requests.php
r13092 r13441 14 14 */ 15 15 function friends_screen_requests() { 16 $redirect = false; 17 16 18 if ( bp_is_action_variable( 'accept', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) { 17 19 // Check the nonce. 18 20 check_admin_referer( 'friends_accept_friendship' ); 19 21 20 if ( friends_accept_friendship( bp_action_variable( 1 ) ) ) 22 if ( friends_accept_friendship( bp_action_variable( 1 ) ) ) { 21 23 bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) ); 22 else24 } else { 23 25 bp_core_add_message( __( 'Friendship could not be accepted', 'buddypress' ), 'error' ); 26 } 24 27 25 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) );28 $redirect = true; 26 29 27 30 } elseif ( bp_is_action_variable( 'reject', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) { … … 29 32 check_admin_referer( 'friends_reject_friendship' ); 30 33 31 if ( friends_reject_friendship( bp_action_variable( 1 ) ) ) 34 if ( friends_reject_friendship( bp_action_variable( 1 ) ) ) { 32 35 bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) ); 33 else36 } else { 34 37 bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress' ), 'error' ); 38 } 35 39 36 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) );40 $redirect = true; 37 41 38 42 } elseif ( bp_is_action_variable( 'cancel', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) { … … 40 44 check_admin_referer( 'friends_withdraw_friendship' ); 41 45 42 if ( friends_withdraw_friendship( bp_loggedin_user_id(), bp_action_variable( 1 ) ) ) 46 if ( friends_withdraw_friendship( bp_loggedin_user_id(), bp_action_variable( 1 ) ) ) { 43 47 bp_core_add_message( __( 'Friendship request withdrawn', 'buddypress' ) ); 44 else48 } else { 45 49 bp_core_add_message( __( 'Friendship request could not be withdrawn', 'buddypress' ), 'error' ); 50 } 46 51 47 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) ); 52 $redirect = true; 53 } 54 55 if ( $redirect ) { 56 $friends_slug = bp_get_friends_slug(); 57 58 bp_core_redirect( 59 bp_loggedin_user_url( 60 array( 61 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ), 62 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 63 ) 64 ) 65 ); 48 66 } 49 67 -
trunk/src/bp-groups/actions/leave-group.php
r13437 r13441 46 46 } 47 47 48 $group = groups_get_current_group();48 $group = groups_get_current_group(); 49 49 $redirect = bp_get_group_url( $group ); 50 50 51 51 if ( ! $group->is_visible ) { 52 $redirect = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ); 52 $groups_slug = bp_get_groups_slug(); 53 $redirect = bp_loggedin_user_url( 54 array( 55 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ), 56 ) 57 ); 53 58 } 54 59 -
trunk/src/bp-groups/bp-groups-adminbar.php
r13437 r13441 57 57 } 58 58 59 $manage_screens = bp_get_group_screens( 'manage' ); 60 59 61 // Build the Group Admin menus. 60 62 foreach ( $secondary_nav_items as $menu ) { … … 66 68 * the 'show_in_admin_bar' argument of your edit screen to true 67 69 */ 68 if ( $menu->show_in_admin_bar ) {70 if ( $menu->show_in_admin_bar && isset( $manage_screens[ $menu->slug ] ) ) { 69 71 /* translators: %s the group menu name */ 70 72 $title = sprintf( _x( 'Edit Group %s', 'Group WP Admin Bar manage links', 'buddypress' ), $menu->name ); … … 76 78 } 77 79 78 $wp_admin_bar->add_node( array( 79 'parent' => $bp->group_admin_menu_id, 80 'id' => $menu->slug, 81 'title' => $title, 82 'href' => bp_get_groups_action_link( 'admin/' . $menu->slug ) 83 ) ); 80 $wp_admin_bar->add_node( 81 array( 82 'parent' => $bp->group_admin_menu_id, 83 'id' => $menu->slug, 84 'title' => $title, 85 'href' => bp_get_group_url( 86 $bp->groups->current_group, 87 array( 88 'single_item_action' => bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ), 89 'single_item_action_variables' => bp_rewrites_get_slug( 'groups', $manage_screens[ $menu->slug ]['rewrite_id'], $menu->slug ), 90 ) 91 ), 92 ) 93 ); 84 94 } 85 95 } -
trunk/src/bp-groups/bp-groups-notifications.php
r13437 r13441 531 531 $group_id = $item_id; 532 532 533 $group = groups_get_group( $group_id ); 534 $group_link = bp_get_group_url( $group ); 535 $amount = 'single'; 533 $group = groups_get_group( $group_id ); 534 $group_link = bp_get_group_url( $group ); 535 $groups_slug = bp_get_groups_slug(); 536 $custom_groups_slug = bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ); 537 $amount = 'single'; 536 538 537 539 if ( (int) $total_items > 1 ) { … … 539 541 $text = sprintf( __( '%1$d accepted group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name ); 540 542 $amount = 'multiple'; 541 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 543 $notification_link = add_query_arg( 544 'n', 545 1, 546 bp_loggedin_user_url( 547 array( 548 'single_item_component' => $custom_groups_slug, 549 ) 550 ) 551 ); 542 552 543 553 if ( 'string' == $format ) { … … 622 632 $group_id = $item_id; 623 633 624 $group = groups_get_group( $group_id ); 625 $group_link = bp_get_group_url( $group ); 626 $amount = 'single'; 634 $group = groups_get_group( $group_id ); 635 $group_link = bp_get_group_url( $group ); 636 $groups_slug = bp_get_groups_slug(); 637 $custom_groups_slug = bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ); 638 $amount = 'single'; 627 639 628 640 if ( (int) $total_items > 1 ) { … … 630 642 $text = sprintf( __( '%1$d rejected group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name ); 631 643 $amount = 'multiple'; 632 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 644 $notification_link = add_query_arg( 645 'n', 646 1, 647 bp_loggedin_user_url( 648 array( 649 'single_item_component' => $custom_groups_slug, 650 ) 651 ) 652 ); 633 653 634 654 if ( 'string' == $format ) { … … 712 732 $group_id = $item_id; 713 733 714 $group = groups_get_group( $group_id ); 715 $group_link = bp_get_group_url( $group ); 716 $amount = 'single'; 734 $group = groups_get_group( $group_id ); 735 $group_link = bp_get_group_url( $group ); 736 $groups_slug = bp_get_groups_slug(); 737 $custom_groups_slug = bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ); 738 $amount = 'single'; 717 739 718 740 if ( (int) $total_items > 1 ) { … … 720 742 $text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items ); 721 743 $amount = 'multiple'; 722 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 744 $notification_link = add_query_arg( 745 'n', 746 1, 747 bp_loggedin_user_url( 748 array( 749 'single_item_component' => $custom_groups_slug, 750 ) 751 ) 752 ); 723 753 724 754 if ( 'string' == $format ) { … … 796 826 $group_id = $item_id; 797 827 798 $group = groups_get_group( $group_id ); 799 $group_link = bp_get_group_url( $group ); 800 $amount = 'single'; 828 $group = groups_get_group( $group_id ); 829 $group_link = bp_get_group_url( $group ); 830 $groups_slug = bp_get_groups_slug(); 831 $custom_groups_slug = bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ); 832 $amount = 'single'; 801 833 802 834 if ( (int) $total_items > 1 ) { … … 804 836 $text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items ); 805 837 $amount = 'multiple'; 806 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 838 $notification_link = add_query_arg( 839 'n', 840 1, 841 bp_loggedin_user_url( 842 array( 843 'single_item_component' => $custom_groups_slug, 844 ) 845 ) 846 ); 807 847 808 848 if ( 'string' == $format ) { … … 878 918 879 919 case 'group_invite': 880 $group_id = $item_id; 881 $group = groups_get_group( $group_id ); 882 $group_link = bp_get_group_url( $group ); 883 $amount = 'single'; 884 885 $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1'; 920 $group_id = $item_id; 921 $group = groups_get_group( $group_id ); 922 $group_link = bp_get_group_url( $group ); 923 $groups_slug = bp_get_groups_slug(); 924 $custom_groups_slug = bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ); 925 $amount = 'single'; 926 $notification_link = add_query_arg( 927 'n', 928 1, 929 bp_loggedin_user_url( 930 array( 931 'single_item_component' => $custom_groups_slug, 932 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_invites', 'invites' ), 933 ) 934 ) 935 ); 886 936 887 937 if ( (int) $total_items > 1 ) { -
trunk/src/bp-groups/bp-groups-template.php
r13437 r13441 1274 1274 1275 1275 if ( $slug ) { 1276 $supported_chunks = array_fill_keys( array( 'single_item_ component', 'single_item_action', 'single_item_action_variables' ), true );1276 $supported_chunks = array_fill_keys( array( 'single_item_action', 'single_item_action_variables' ), true ); 1277 1277 $path_chunks = bp_parse_args( 1278 1278 array_intersect_key( $path_chunks, $supported_chunks ), … … 3341 3341 } 3342 3342 3343 $views = bp_get_group_screens( 'manage' ); 3344 if ( isset( $views[ $page ]['rewrite_id'] ) ) { 3345 $page = bp_rewrites_get_slug( 'groups', $views[ $page ]['rewrite_id'], $page ); 3346 } 3347 3348 $url = bp_get_group_url( 3349 $group, 3350 array( 3351 'single_item_action' => bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ), 3352 'single_item_action_variables' => $page, 3353 ) 3354 ); 3355 3343 3356 /** 3344 3357 * Filters the 'action' attribute for a group admin form. … … 3348 3361 * @since 10.0.0 Added the `$page` parameter. 3349 3362 * 3350 * @param string $ valueAction attribute for a group admin form.3363 * @param string $url Action attribute for a group admin form. 3351 3364 * @param BP_Groups_Group $group The group object. 3352 3365 * @param int|string|bool $page Page slug. 3353 3366 */ 3354 return apply_filters( 'bp_group_admin_form_action', trailingslashit( bp_get_group_permalink( $group ) . 'admin/' . $page ), $group, $page );3367 return apply_filters( 'bp_group_admin_form_action', $url, $group, $page ); 3355 3368 } 3356 3369 … … 3526 3539 } 3527 3540 3528 $user_domain = bp_loggedin_user_domain(); 3541 $groups_slug = bp_get_groups_slug(); 3542 $path_chunks = array( 3543 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ), 3544 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_invites', 'invites' ), 3545 'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_invites_accept', 'accept' ), $group->id ), 3546 ); 3547 3529 3548 if ( bp_is_user() ) { 3530 $user_domain = bp_displayed_user_domain(); 3531 } 3549 $user_domain = bp_displayed_user_url( $path_chunks ); 3550 } else { 3551 $user_domain = bp_loggedin_user_url( $path_chunks ); 3552 } 3553 3554 $url = wp_nonce_url( $user_domain, 'groups_accept_invite' ); 3532 3555 3533 3556 /** … … 3537 3560 * @since 2.5.0 Added the `$group` parameter. 3538 3561 * 3539 * @param string $ valueURL for accepting an invitation to a group.3562 * @param string $url URL for accepting an invitation to a group. 3540 3563 * @param object $group Group object. 3541 3564 */ 3542 return apply_filters( 'bp_get_group_accept_invite_link', wp_nonce_url( trailingslashit( $user_domain . bp_get_groups_slug() . '/invites/accept/' . $group->id ), 'groups_accept_invite' ), $group );3565 return apply_filters( 'bp_get_group_accept_invite_link', $url, $group ); 3543 3566 } 3544 3567 … … 3567 3590 } 3568 3591 3569 $user_domain = bp_loggedin_user_domain(); 3592 $groups_slug = bp_get_groups_slug(); 3593 $path_chunks = array( 3594 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ), 3595 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_invites', 'invites' ), 3596 'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_invites_reject', 'reject' ), $group->id ), 3597 ); 3598 3570 3599 if ( bp_is_user() ) { 3571 $user_domain = bp_displayed_user_domain(); 3572 } 3600 $user_domain = bp_displayed_user_url( $path_chunks ); 3601 } else { 3602 $user_domain = bp_loggedin_user_url( $path_chunks ); 3603 } 3604 3605 $url = wp_nonce_url( $user_domain, 'groups_reject_invite' ); 3573 3606 3574 3607 /** … … 3578 3611 * @since 2.5.0 Added the `$group` parameter. 3579 3612 * 3580 * @param string $ valueURL for rejecting an invitation to a group.3613 * @param string $url URL for rejecting an invitation to a group. 3581 3614 * @param object $group Group object. 3582 3615 */ 3583 return apply_filters( 'bp_get_group_reject_invite_link', wp_nonce_url( trailingslashit( $user_domain . bp_get_groups_slug() . '/invites/reject/' . $group->id ), 'groups_reject_invite' ), $group );3616 return apply_filters( 'bp_get_group_reject_invite_link', $url, $group ); 3584 3617 } 3585 3618 -
trunk/src/bp-groups/classes/class-bp-group-extension.php
r13437 r13441 737 737 'slug' => $this->slug, 738 738 'parent_slug' => bp_get_current_group_slug(), 739 'parent_url' => $group_permalink,740 739 'position' => $this->nav_item_position, 741 740 'item_css_id' => 'nav-' . $this->slug, … … 960 959 } 961 960 962 $screen = $this->screens['edit']; 963 964 $position = isset( $screen['position'] ) ? (int) $screen['position'] : 10; 965 $position += 40; 966 961 $screen = $this->screens['edit']; 962 $position = isset( $screen['position'] ) ? (int) $screen['position'] : 10; 963 $position += 40; 967 964 $current_group = groups_get_current_group(); 968 $admin_link = trailingslashit( bp_get_group_permalink( $current_group ) . 'admin' );969 965 970 966 $subnav_args = array( … … 972 968 'slug' => $screen['slug'], 973 969 'parent_slug' => $current_group->slug . '_manage', 974 'parent_url' => $admin_link,975 970 'user_has_access' => bp_is_item_admin(), 976 971 'position' => $position, -
trunk/src/bp-groups/classes/class-bp-groups-component.php
r13437 r13441 315 315 316 316 // Initialize the nav for the groups component. 317 $this->nav = new BP_Core_Nav( $this->current_group->id );317 $this->nav = new BP_Core_Nav( $this->current_group->id, $this->id ); 318 318 319 319 // Set current_group to 0 to prevent debug errors. … … 566 566 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 567 567 568 // Determine user to use. 569 if ( bp_displayed_user_domain() ) { 570 $user_domain = bp_displayed_user_domain(); 571 } elseif ( bp_loggedin_user_domain() ) { 572 $user_domain = bp_loggedin_user_domain(); 573 } else { 574 $user_domain = false; 575 } 576 577 // Only grab count if we're on a user page. 578 if ( bp_is_user() ) { 579 $class = ( 0 === groups_total_groups_for_user( bp_displayed_user_id() ) ) ? 'no-count' : 'count'; 580 581 $nav_name = sprintf( 582 /* translators: %s: Group count for the current user */ 583 _x( 'Groups %s', 'Group screen nav with counter', 'buddypress' ), 584 sprintf( 585 '<span class="%s">%s</span>', 586 esc_attr( $class ), 587 bp_get_total_group_count_for_user() 588 ) 568 if ( is_user_logged_in() || bp_displayed_user_id() ) { 569 // Only grab count if we're on a user page. 570 if ( bp_is_user() ) { 571 $class = ( 0 === groups_total_groups_for_user( bp_displayed_user_id() ) ) ? 'no-count' : 'count'; 572 573 $nav_name = sprintf( 574 /* translators: %s: Group count for the current user */ 575 _x( 'Groups %s', 'Group screen nav with counter', 'buddypress' ), 576 sprintf( 577 '<span class="%s">%s</span>', 578 esc_attr( $class ), 579 bp_get_total_group_count_for_user() 580 ) 581 ); 582 } else { 583 $nav_name = _x( 'Groups', 'Group screen nav without counter', 'buddypress' ); 584 } 585 586 $slug = bp_get_groups_slug(); 587 $access = bp_core_can_edit_settings(); 588 589 // Add 'Groups' to the main navigation. 590 $main_nav = array( 591 'name' => $nav_name, 592 'slug' => $slug, 593 'position' => 70, 594 'screen_function' => 'groups_screen_my_groups', 595 'default_subnav_slug' => 'my-groups', 596 'item_css_id' => $this->id 589 597 ); 590 } else {591 $nav_name = _x( 'Groups', 'Group screen nav without counter', 'buddypress' );592 }593 594 $slug = bp_get_groups_slug();595 596 // Add 'Groups' to the main navigation.597 $main_nav = array(598 'name' => $nav_name,599 'slug' => $slug,600 'position' => 70,601 'screen_function' => 'groups_screen_my_groups',602 'default_subnav_slug' => 'my-groups',603 'item_css_id' => $this->id604 );605 606 if ( ! empty( $user_domain ) ) {607 $access = bp_core_can_edit_settings();608 $groups_link = trailingslashit( $user_domain . $slug );609 598 610 599 // Add the My Groups nav item. … … 612 601 'name' => __( 'Memberships', 'buddypress' ), 613 602 'slug' => 'my-groups', 614 'parent_url' => $groups_link,615 603 'parent_slug' => $slug, 616 604 'screen_function' => 'groups_screen_my_groups', … … 624 612 'name' => __( 'Invitations', 'buddypress' ), 625 613 'slug' => 'invites', 626 'parent_url' => $groups_link,627 614 'parent_slug' => $slug, 628 615 'screen_function' => 'groups_screen_group_invites', … … 659 646 'name' => _x( 'Home', 'Group screen navigation title', 'buddypress' ), 660 647 'slug' => 'home', 661 'parent_url' => $group_link,662 648 'parent_slug' => $this->current_group->slug, 663 649 'screen_function' => 'groups_screen_group_home', … … 674 660 'name' => _x( 'Request Membership','Group screen nav', 'buddypress' ), 675 661 'slug' => 'request-membership', 676 'parent_url' => $group_link,677 662 'parent_slug' => $this->current_group->slug, 678 663 'screen_function' => 'groups_screen_group_request_membership', … … 689 674 'name' => _x( 'Activity', 'My Group screen nav', 'buddypress' ), 690 675 'slug' => 'activity', 691 'parent_url' => $group_link,692 676 'parent_slug' => $this->current_group->slug, 693 677 'screen_function' => 'groups_screen_group_activity', … … 709 693 ), 710 694 'slug' => 'members', 711 'parent_url' => $group_link,712 695 'parent_slug' => $this->current_group->slug, 713 696 'screen_function' => 'groups_screen_group_members', … … 723 706 'name' => _x( 'Send Invites', 'My Group screen nav', 'buddypress' ), 724 707 'slug' => 'send-invites', 725 'parent_url' => $group_link,726 708 'parent_slug' => $this->current_group->slug, 727 709 'screen_function' => 'groups_screen_group_invite', … … 738 720 'name' => _x( 'Manage', 'My Group screen nav', 'buddypress' ), 739 721 'slug' => 'admin', 740 'parent_url' => $group_link,741 722 'parent_slug' => $this->current_group->slug, 742 723 'screen_function' => 'groups_screen_group_admin', … … 747 728 ); 748 729 749 $admin_link = trailingslashit( $group_link . 'admin' ); 730 $admin_link = bp_get_group_url( 731 $this->current_group, 732 array( 733 'single_item_action' => bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ), 734 ) 735 ); 750 736 751 737 // Common params to all nav items. 752 738 $default_params = array( 753 'parent_url' => $admin_link,754 739 'parent_slug' => $this->current_group->slug . '_manage', 755 740 'screen_function' => 'groups_screen_group_admin', … … 845 830 846 831 // Setup the logged in user variables. 847 $groups_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ); 832 $groups_slug = bp_get_groups_slug(); 833 $custom_groups_slug = bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ); 848 834 849 835 $title = _x( 'Groups', 'My Account Groups', 'buddypress' ); … … 873 859 'id' => 'my-account-' . $this->id, 874 860 'title' => $title, 875 'href' => $groups_link 861 'href' => bp_loggedin_user_url( 862 array( 863 'single_item_component' => $custom_groups_slug, 864 ) 865 ), 876 866 ); 877 867 … … 881 871 'id' => 'my-account-' . $this->id . '-memberships', 882 872 'title' => _x( 'Memberships', 'My Account Groups sub nav', 'buddypress' ), 883 'href' => trailingslashit( $groups_link . 'my-groups' ), 884 'position' => 10 873 'href' => bp_loggedin_user_url( 874 array( 875 'single_item_component' => $custom_groups_slug, 876 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_my_groups', 'my-groups' ), 877 ) 878 ), 879 'position' => 10, 885 880 ); 886 881 … … 891 886 'id' => 'my-account-' . $this->id . '-invites', 892 887 'title' => $pending, 893 'href' => trailingslashit( $groups_link . 'invites' ), 894 'position' => 30 888 'href' => bp_loggedin_user_url( 889 array( 890 'single_item_component' => $custom_groups_slug, 891 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_invites', 'invites' ), 892 ) 893 ), 894 'position' => 30, 895 895 ); 896 896 } -
trunk/src/bp-groups/screens/single/admin/delete-group.php
r11923 r13441 15 15 function groups_screen_group_admin_delete_group() { 16 16 17 if ( 'delete-group' != bp_get_group_current_admin_tab() ) 17 if ( 'delete-group' != bp_get_group_current_admin_tab() ) { 18 18 return false; 19 } 19 20 20 if ( ! bp_is_item_admin() && !bp_current_user_can( 'bp_moderate' ) ) 21 if ( ! bp_is_item_admin() && !bp_current_user_can( 'bp_moderate' ) ) { 21 22 return false; 23 } 22 24 23 25 $bp = buddypress(); 24 26 25 27 if ( isset( $_REQUEST['delete-group-button'] ) && isset( $_REQUEST['delete-group-understand'] ) ) { 28 $groups_slug = bp_get_groups_slug(); 29 $redirect = bp_loggedin_user_url( 30 array( 31 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ), 32 ) 33 ); 26 34 27 35 // Check the nonce first. 28 if ( ! check_admin_referer( 'groups_delete_group' ) ) {36 if ( ! check_admin_referer( 'groups_delete_group' ) ) { 29 37 return false; 30 38 } … … 40 48 41 49 // Group admin has deleted the group, now do it. 42 if ( ! groups_delete_group( $bp->groups->current_group->id ) ) {50 if ( ! groups_delete_group( $bp->groups->current_group->id ) ) { 43 51 bp_core_add_message( __( 'There was an error deleting the group. Please try again.', 'buddypress' ), 'error' ); 44 52 } else { … … 53 61 */ 54 62 do_action( 'groups_group_deleted', $bp->groups->current_group->id ); 55 56 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) );57 63 } 58 64 59 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ));65 bp_core_redirect( $redirect ); 60 66 } 61 67 -
trunk/src/bp-members/bp-members-adminbar.php
r13395 r13441 43 43 'group' => true, 44 44 'title' => __( 'Edit My Profile', 'buddypress' ), 45 'href' => bp_loggedin_user_ domain(),45 'href' => bp_loggedin_user_url(), 46 46 'meta' => array( 47 47 'class' => 'ab-sub-secondary' … … 201 201 202 202 if ( bp_current_user_can( 'bp_members_invitations_view_screens' ) ) { 203 $bp = buddypress(); 204 $invitations_link = trailingslashit( bp_loggedin_user_domain() . bp_get_members_invitations_slug() ); 203 $bp = buddypress(); 204 $invite_slug = bp_get_members_invitations_slug(); 205 $custom_invite_slug = bp_rewrites_get_slug( 'members', 'member_' . $invite_slug, $invite_slug ); 205 206 206 207 $wp_admin_bar->add_node( … … 209 210 'parent' => $bp->my_account_menu_id, 210 211 'title' => __( 'Invitations', 'buddypress' ), 211 'href' => $invitations_link, 212 'href' => bp_loggedin_user_url( 213 array( 214 'single_item_component' => $custom_invite_slug, 215 ) 216 ), 212 217 'meta' => array( 213 218 'class' => 'ab-sub-secondary' … … 222 227 'parent' => $bp->my_account_menu_id . '-invitations', 223 228 'title' => __( 'Send Invites', 'buddypress' ), 224 'href' => $invitations_link . 'send-invites/', 229 'href' => bp_loggedin_user_url( 230 array( 231 'single_item_component' => $custom_invite_slug, 232 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $invite_slug . '_send_invites', 'send-invites' ), 233 ) 234 ), 225 235 'meta' => array( 226 236 'class' => 'ab-sub-secondary' … … 235 245 'parent' => $bp->my_account_menu_id . '-invitations', 236 246 'title' => __( 'Pending Invites', 'buddypress' ), 237 'href' => $invitations_link . 'list-invites/', 247 'href' => bp_loggedin_user_url( 248 array( 249 'single_item_component' => $custom_invite_slug, 250 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $invite_slug . '_list_invites', 'list-invites' ), 251 ) 252 ), 238 253 'meta' => array( 239 254 'class' => 'ab-sub-secondary' -
trunk/src/bp-members/bp-members-invitations.php
r13395 r13441 36 36 ); 37 37 38 $parent_link = trailingslashit( bp_displayed_user_domain() . bp_get_members_invitations_slug() );39 40 38 /* Create two subnav items for community invitations */ 41 39 bp_core_new_subnav_item( … … 44 42 'slug' => 'send-invites', 45 43 'parent_slug' => bp_get_members_invitations_slug(), 46 'parent_url' => $parent_link,47 44 'screen_function' => 'members_screen_send_invites', 48 45 'position' => 10, … … 56 53 'slug' => 'list-invites', 57 54 'parent_slug' => bp_get_members_invitations_slug(), 58 'parent_url' => $parent_link,59 55 'screen_function' => 'members_screen_list_sent_invites', 60 56 'position' => 20, -
trunk/src/bp-members/bp-members-template.php
r13436 r13441 1587 1587 } 1588 1588 1589 if ( bp_loggedin_user_ domain() ) {1590 $link = str_replace( bp_loggedin_user_ domain(), bp_displayed_user_domain(), $user_nav_item->link );1589 if ( bp_loggedin_user_url() ) { 1590 $link = str_replace( bp_loggedin_user_url(), bp_displayed_user_url(), $user_nav_item->link ); 1591 1591 } else { 1592 $link = trailingslashit( bp_displayed_user_domain() . $user_nav_item->link );1592 $link = $user_nav_item->link; 1593 1593 } 1594 1594 -
trunk/src/bp-members/classes/class-bp-members-component.php
r13437 r13441 429 429 $subnavs = array(); 430 430 431 $access = bp_core_can_edit_settings(); 432 $slug = bp_get_profile_slug(); 433 $profile_link = bp_get_members_component_link( buddypress()->profile->id ); 431 $access = bp_core_can_edit_settings(); 432 $slug = bp_get_profile_slug(); 434 433 435 434 // Change Avatar. … … 438 437 'name' => _x( 'Change Profile Photo', 'Profile header sub menu', 'buddypress' ), 439 438 'slug' => 'change-avatar', 440 'parent_url' => $profile_link,441 439 'parent_slug' => $slug, 442 440 'screen_function' => 'bp_members_screen_change_avatar', … … 451 449 'name' => _x( 'Change Cover Image', 'Profile header sub menu', 'buddypress' ), 452 450 'slug' => 'change-cover-image', 453 'parent_url' => $profile_link,454 451 'parent_slug' => $slug, 455 452 'screen_function' => 'bp_members_screen_change_cover_image', … … 486 483 if ( ! bp_displayed_user_has_front_template() && $is_xprofile_active ) { 487 484 add_action( 'bp_xprofile_setup_nav', array( $this, 'setup_xprofile_nav' ) ); 488 return;489 }490 491 // Determine user to use.492 if ( bp_displayed_user_domain() ) {493 $user_domain = bp_displayed_user_domain();494 } elseif ( bp_loggedin_user_domain() ) {495 $user_domain = bp_loggedin_user_domain();496 } else {497 485 return; 498 486 } … … 534 522 'name' => _x( 'View', 'Member profile view', 'buddypress' ), 535 523 'slug' => 'public', 536 'parent_url' => trailingslashit( $user_domain . $slug ),537 524 'parent_slug' => $slug, 538 525 'screen_function' => 'bp_members_screen_display_profile', … … 556 543 $front_subnav = $this->sub_nav; 557 544 $front_subnav['parent_slug'] = 'front'; 558 559 // In case the subnav is displayed in the front template560 $front_subnav['parent_url'] = trailingslashit( $user_domain . 'front' );561 545 562 546 // Set the subnav -
trunk/src/bp-messages/classes/class-bp-messages-component.php
r13435 r13441 197 197 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 198 198 199 // Determine user to use. 200 if ( bp_displayed_user_domain() ) { 201 $user_domain = bp_displayed_user_domain(); 202 } elseif ( bp_loggedin_user_domain() ) { 203 $user_domain = bp_loggedin_user_domain(); 204 } else { 199 // Stop if there is no user displayed or logged in. 200 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 205 201 return; 206 202 } 207 203 208 $access = bp_core_can_edit_settings(); 209 $slug = bp_get_messages_slug(); 210 $messages_link = trailingslashit( $user_domain . $slug ); 204 $access = bp_core_can_edit_settings(); 205 $slug = bp_get_messages_slug(); 211 206 212 207 // Only grab count if we're on a user page and current user has access. … … 242 237 'name' => __( 'Inbox', 'buddypress' ), 243 238 'slug' => 'inbox', 244 'parent_url' => $messages_link,245 239 'parent_slug' => $slug, 246 240 'screen_function' => 'messages_screen_inbox', … … 253 247 'name' => __( 'Starred', 'buddypress' ), 254 248 'slug' => bp_get_messages_starred_slug(), 255 'parent_url' => $messages_link,256 249 'parent_slug' => $slug, 257 250 'screen_function' => 'bp_messages_star_screen', … … 264 257 'name' => __( 'Sent', 'buddypress' ), 265 258 'slug' => 'sentbox', 266 'parent_url' => $messages_link,267 259 'parent_slug' => $slug, 268 260 'screen_function' => 'messages_screen_sentbox', … … 275 267 'name' => __( 'Compose', 'buddypress' ), 276 268 'slug' => 'compose', 277 'parent_url' => $messages_link,278 269 'parent_slug' => $slug, 279 270 'screen_function' => 'messages_screen_compose', … … 286 277 'name' => __( 'Notices', 'buddypress' ), 287 278 'slug' => 'notices', 288 'parent_url' => $messages_link,289 279 'parent_slug' => $slug, 290 280 'screen_function' => 'messages_screen_notices', -
trunk/src/bp-notifications/classes/class-bp-notifications-component.php
r13432 r13441 147 147 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 148 148 149 // Determine user to use. 150 if ( bp_displayed_user_domain() ) { 151 $user_domain = bp_displayed_user_domain(); 152 } elseif ( bp_loggedin_user_domain() ) { 153 $user_domain = bp_loggedin_user_domain(); 154 } else { 149 // Stop if there is no user displayed or logged in. 150 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 155 151 return; 156 152 } 157 153 158 $access = bp_core_can_edit_settings(); 159 $slug = bp_get_notifications_slug(); 160 $notifications_link = trailingslashit( $user_domain . $slug ); 154 $access = bp_core_can_edit_settings(); 155 $slug = bp_get_notifications_slug(); 161 156 162 157 // Only grab count if we're on a user page and current user has access. … … 192 187 'name' => _x( 'Unread', 'Notification screen nav', 'buddypress' ), 193 188 'slug' => 'unread', 194 'parent_url' => $notifications_link,195 189 'parent_slug' => $slug, 196 190 'screen_function' => 'bp_notifications_screen_unread', … … 203 197 'name' => _x( 'Read', 'Notification screen nav', 'buddypress' ), 204 198 'slug' => 'read', 205 'parent_url' => $notifications_link,206 199 'parent_slug' => $slug, 207 200 'screen_function' => 'bp_notifications_screen_read', -
trunk/src/bp-settings/classes/class-bp-settings-component.php
r13432 r13441 133 133 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 134 134 135 // Determine user to use. 136 if ( bp_displayed_user_domain() ) { 137 $user_domain = bp_displayed_user_domain(); 138 } elseif ( bp_loggedin_user_domain() ) { 139 $user_domain = bp_loggedin_user_domain(); 140 } else { 135 // Stop if there is no user displayed or logged in. 136 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 141 137 return; 142 138 } 143 139 144 $access = bp_core_can_edit_settings(); 145 $slug = bp_get_settings_slug(); 146 $settings_link = trailingslashit( $user_domain . $slug ); 140 $access = bp_core_can_edit_settings(); 141 $slug = bp_get_settings_slug(); 147 142 148 143 // Add the settings navigation item. … … 160 155 'name' => __( 'General', 'buddypress' ), 161 156 'slug' => 'general', 162 'parent_url' => $settings_link,163 157 'parent_slug' => $slug, 164 158 'screen_function' => 'bp_settings_screen_general', … … 172 166 'name' => __( 'Email', 'buddypress' ), 173 167 'slug' => 'notifications', 174 'parent_url' => $settings_link,175 168 'parent_slug' => $slug, 176 169 'screen_function' => 'bp_settings_screen_notification', … … 184 177 'name' => __( 'Capabilities', 'buddypress' ), 185 178 'slug' => 'capabilities', 186 'parent_url' => $settings_link,187 179 'parent_slug' => $slug, 188 180 'screen_function' => 'bp_settings_screen_capabilities', … … 206 198 'name' => __( 'Export Data', 'buddypress' ), 207 199 'slug' => 'data', 208 'parent_url' => $settings_link,209 200 'parent_slug' => $slug, 210 201 'screen_function' => 'bp_settings_screen_data', … … 219 210 'name' => __( 'Delete Account', 'buddypress' ), 220 211 'slug' => 'delete-account', 221 'parent_url' => $settings_link,222 212 'parent_slug' => $slug, 223 213 'screen_function' => 'bp_settings_screen_delete_account', -
trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php
r13437 r13441 434 434 */ 435 435 function bp_nouveau_groups_invites_restriction_nav() { 436 $slug = bp_nouveau_get_component_slug( 'settings' );437 $user_domain = bp_loggedin_user_domain();438 439 if ( bp_displayed_user_domain() ) {440 $user_domain = bp_displayed_user_domain();441 }442 436 443 437 bp_core_new_subnav_item( array( 444 438 'name' => _x( 'Group Invites', 'Group invitations main menu title', 'buddypress' ), 445 439 'slug' => 'invites', 446 'parent_url' => trailingslashit( $user_domain . $slug ), 447 'parent_slug' => $slug, 440 'parent_slug' => bp_nouveau_get_component_slug( 'settings' ), 448 441 'screen_function' => 'bp_nouveau_groups_screen_invites_restriction', 449 442 'item_css_id' => 'invites', -
trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php
r13274 r13441 100 100 101 101 // Make sure to use the displayed user domain. 102 if ( bp_loggedin_user_ domain() ) {103 $root_url = str_replace( bp_loggedin_user_ domain(), bp_displayed_user_domain(), $root_url );102 if ( bp_loggedin_user_url() ) { 103 $root_url = str_replace( bp_loggedin_user_url(), bp_displayed_user_url(), $root_url ); 104 104 } 105 105 } else { 106 $root_url = trailingslashit( bp_displayed_user_domain() . $slug );106 $root_url = $primary_nav->link; 107 107 } 108 108 -
trunk/src/bp-templates/bp-nouveau/includes/template-tags.php
r13437 r13441 1087 1087 1088 1088 if ( 'personal' === $bp_nouveau->displayed_nav && ! empty( $nav_item->primary ) ) { 1089 if ( bp_loggedin_user_domain() ) { 1090 $link = str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $link ); 1091 } else { 1092 $link = trailingslashit( bp_displayed_user_domain() . $link ); 1089 if ( bp_loggedin_user_url() ) { 1090 $link = str_replace( bp_loggedin_user_url(), bp_displayed_user_url(), $link ); 1093 1091 } 1094 1092 } -
trunk/src/bp-xprofile/classes/class-bp-xprofile-component.php
r13432 r13441 230 230 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 231 231 232 // Determine user to use. 233 if ( bp_displayed_user_domain() ) { 234 $user_domain = bp_displayed_user_domain(); 235 } elseif ( bp_loggedin_user_domain() ) { 236 $user_domain = bp_loggedin_user_domain(); 237 } else { 232 // Stop if there is no user displayed or logged in. 233 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 238 234 return; 239 235 } 240 236 241 $access = bp_core_can_edit_settings(); 242 $slug = bp_get_profile_slug(); 243 $profile_link = trailingslashit( $user_domain . $slug ); 237 $access = bp_core_can_edit_settings(); 238 $slug = bp_get_profile_slug(); 244 239 245 240 // Add 'Profile' to the main navigation. … … 257 252 'name' => _x( 'View', 'Profile header sub menu', 'buddypress' ), 258 253 'slug' => 'public', 259 'parent_url' => $profile_link,260 254 'parent_slug' => $slug, 261 255 'screen_function' => 'xprofile_screen_display_profile', … … 267 261 'name' => _x( 'Edit','Profile header sub menu', 'buddypress' ), 268 262 'slug' => 'edit', 269 'parent_url' => $profile_link,270 263 'parent_slug' => $slug, 271 264 'screen_function' => 'xprofile_screen_edit_profile', … … 294 287 } 295 288 296 // Determine user to use. 297 if ( bp_displayed_user_domain() ) { 298 $user_domain = bp_displayed_user_domain(); 299 } elseif ( bp_loggedin_user_domain() ) { 300 $user_domain = bp_loggedin_user_domain(); 301 } else { 289 // Stop if there is no user displayed or logged in. 290 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 302 291 return; 303 292 } … … 309 298 'name' => _x( 'Profile Visibility', 'Profile settings sub nav', 'buddypress' ), 310 299 'slug' => 'profile', 311 'parent_url' => trailingslashit( $user_domain . $settings_slug ),312 300 'parent_slug' => $settings_slug, 313 301 'screen_function' => 'bp_xprofile_screen_settings', -
trunk/tests/phpunit/testcases/core/nav/bpCoreNewNavItem.php
r13437 r13441 173 173 'name' => 'Settings', 174 174 'slug' => 'settings', 175 'link' => trailingslashit( bp_loggedin_user_domain() . 'settings' ), 175 'link' => bp_members_get_user_url( 176 $u, 177 array( 178 'single_item_component' => 'settings', 179 ) 180 ), 176 181 'css_id' => 'settings', 177 182 'show_for_displayed_user' => false, … … 218 223 'name' => 'Woof', 219 224 'slug' => 'woof', 220 'link' => trailingslashit( bp_loggedin_user_domain() . 'woof' ), 225 'link' => bp_members_get_user_url( 226 $u, 227 array( 228 'single_item_component' => 'woof', 229 ) 230 ), 221 231 'css_id' => 'woof', 222 232 'show_for_displayed_user' => false, -
trunk/tests/phpunit/testcases/core/nav/bpCoreNewSubnavItem.php
r13433 r13441 5 5 */ 6 6 class BP_Tests_Core_Nav_BpCoreNewSubnavItem extends BP_UnitTestCase { 7 protected $permalink_structure = ''; 8 9 public function set_up() { 10 parent::set_up(); 11 $this->permalink_structure = get_option( 'permalink_structure', '' ); 12 } 13 14 public function tear_down() { 15 $this->set_permalink_structure( $this->permalink_structure ); 16 17 parent::tear_down(); 18 } 7 19 8 20 /** … … 10 22 */ 11 23 public function test_user_subnav() { 24 $this->set_permalink_structure( '/%postname%/' ); 12 25 $bp_options_nav = buddypress()->bp_options_nav; 13 26 … … 16 29 $this->set_current_user( $u ); 17 30 18 $user_domain = bp_members_get_user_url( $u ); 19 20 $this->go_to( $user_domain ); 31 $this->go_to( bp_members_get_user_url( $u ) ); 21 32 22 33 bp_core_new_nav_item( array( 23 34 'name' => 'Foo Parent', 24 35 'slug' => 'foo-parent', 25 'link' => trailingslashit( $user_domain . 'foo-parent' ),26 36 'screen_function' => 'foo_screen_function', 27 37 'position' => 10, … … 31 41 'name' => 'Foo', 32 42 'slug' => 'foo', 33 'parent_url' => trailingslashit( $user_domain . 'foo-parent' ), 43 'parent_url' => bp_members_get_user_url( 44 $u, 45 array( 46 'single_item_component' => 'foo-parent', 47 ) 48 ), 34 49 'parent_slug' => 'foo-parent', 35 50 'screen_function' => 'foo_screen_function', … … 39 54 $expected = array( 40 55 'name' => 'Foo', 41 'link' => trailingslashit( $user_domain . 'foo-parent/foo' ), 56 'link' => bp_members_get_user_url( 57 $u, 58 array( 59 'single_item_component' => 'foo-parent', 60 'single_item_action' => 'foo', 61 ) 62 ), 42 63 'slug' => 'foo', 43 64 'css_id' => 'foo', … … 63 84 'slug' => 'foo', 64 85 'parent_slug' => 'foo', 65 'parent_url' => 'foo',66 86 'screen_function' => 'foo', 67 87 ) ) ); … … 71 91 'name' => 'foo', 72 92 'parent_slug' => 'foo', 73 'parent_url' => 'foo',74 93 'screen_function' => 'foo', 75 94 ) ) ); … … 79 98 'name' => 'foo', 80 99 'slug' => 'foo', 81 'parent_url' => 'foo',82 'screen_function' => 'foo',83 ) ) );84 85 // 'parent_url'86 $this->assertFalse( bp_core_new_subnav_item( array(87 'name' => 'foo',88 'slug' => 'foo',89 'parent_slug' => 'foo',90 100 'screen_function' => 'foo', 91 101 ) ) ); … … 96 106 'slug' => 'foo', 97 107 'parent_slug' => 'foo', 98 'parent_url' => 'foo',99 108 ) ) ); 100 109 } … … 179 188 'name' => 'Foo', 180 189 'slug' => 'foo', 190 'url' => 'http://example.com/foo/', 181 191 'screen_function' => 'foo', 182 192 'default_subnav_slug' => 'bar', … … 191 201 ) ); 192 202 193 $this->assertSame( 'http://example.com/foo/ ', buddypress()->bp_options_nav['foo']['bar']['link'] );203 $this->assertSame( 'http://example.com/foo/bar/', buddypress()->bp_options_nav['foo']['bar']['link'] ); 194 204 195 205 // clean up … … 202 212 */ 203 213 public function test_should_trailingslash_link_when_link_is_autogenerated_using_slug() { 214 $this->set_permalink_structure( '/%postname%/' ); 204 215 bp_core_new_nav_item( array( 205 216 'name' => 'Foo', … … 225 236 */ 226 237 public function test_should_trailingslash_link_when_link_is_autogenerated_not_using_slug() { 238 $this->set_permalink_structure( '/%postname%/' ); 227 239 bp_core_new_nav_item( array( 228 240 'name' => 'foo', … … 241 253 ) ); 242 254 243 $expected = bp_get_root_domain() . '/foo-parent/ ';255 $expected = bp_get_root_domain() . '/foo-parent/bar/'; 244 256 $this->assertSame( $expected, buddypress()->bp_options_nav['foo-parent']['bar']['link'] ); 245 257 } -
trunk/tests/phpunit/testcases/groups/class-bp-group-extension.php
r13437 r13441 911 911 $g_obj, 912 912 array( 913 'single_item_ component' => 'members',913 'single_item_action' => 'members', 914 914 ) 915 915 )
Note: See TracChangeset
for help on using the changeset viewer.