Changeset 13442
- Timestamp:
- 03/27/2023 06:19:06 PM (19 months ago)
- Location:
- trunk
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/classes/class-bp-blogs-component.php
r13441 r13442 224 224 } 225 225 226 $slug 226 $slug = bp_get_blogs_slug(); 227 227 228 228 // Add 'Sites' to the main navigation. -
trunk/src/bp-core/bp-core-functions.php
r13441 r13442 4882 4882 return (int) apply_filters( 'bp_get_post_type_site_id', $site_id ); 4883 4883 } 4884 4885 /** 4886 * Returns registered navigation items for all or a specific component. 4887 * 4888 * @since 12.0.0 4889 * 4890 * @param string $component The component ID. 4891 * @return array The list of registered navigation items. 4892 */ 4893 function bp_get_component_navigations( $component = '' ) { 4894 $args = array(); 4895 if ( $component ) { 4896 $args['id'] = $component; 4897 } 4898 4899 $components = bp_core_get_active_components( $args, 'objects' ); 4900 $navigations = array(); 4901 4902 foreach ( $components as $key_component => $component ) { 4903 if ( isset( $component->main_nav['rewrite_id'] ) ) { 4904 $navigations[ $key_component ]['main_nav'] = $component->main_nav; 4905 } 4906 4907 if ( isset( $component->sub_nav ) && is_array( $component->sub_nav ) && $component->sub_nav ) { 4908 $navigations[ $key_component ]['sub_nav'] = $component->sub_nav; 4909 } 4910 } 4911 4912 return $navigations; 4913 } -
trunk/src/bp-core/classes/class-bp-component.php
r13432 r13442 187 187 */ 188 188 public $directory_title = ''; 189 190 /** 191 * Component's main nav items. 192 * 193 * @since 12.0.0 194 * @var array 195 */ 196 public $main_nav = array(); 197 198 /** 199 * Component's main nav sub items. 200 * 201 * @since 12.0.0 202 * @var array 203 */ 204 public $sub_nav = array(); 189 205 190 206 /** Methods ***************************************************************/ … … 529 545 530 546 // Setup navigation. 531 add_action( 'bp_setup_nav', array( $this, 'setup_nav' ), 10 ); 547 add_action( 'bp_setup_nav', array( $this, 'setup_nav' ), 9 ); 548 549 // Generate navigation. 550 add_action( 'bp_setup_nav', array( $this, 'generate_nav' ), 10, 0 ); 532 551 533 552 // Setup WP Toolbar menus. … … 598 617 * 599 618 * @since 1.5.0 600 * 601 * @see bp_core_new_nav_item() For a description of the $main_nav 602 * parameter formatting. 603 * @see bp_core_new_subnav_item() For a description of how each item 604 * in the $sub_nav parameter array should be formatted. 619 * @since 12.0.0 Uses `BP_Component::$main_nav` && `BP_Component::$sub_nav` to globalize nav items. 605 620 * 606 621 * @param array $main_nav Optional. Passed directly to bp_core_new_nav_item(). … … 611 626 */ 612 627 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 613 628 if ( isset( $main_nav['slug'] ) ) { 629 // Always set the component ID. 630 $this->main_nav['component_id'] = $this->id; 631 632 if ( ! isset( $main_nav['rewrite_id'] ) ) { 633 $this->main_nav['rewrite_id'] = 'bp_member_' . str_replace( '-', '_', $main_nav['slug'] ); 634 } elseif ( ! $main_nav['rewrite_id'] ) { 635 unset( $main_nav['rewrite_id'] ); 636 } 637 638 $this->main_nav = array_merge( $this->main_nav, $main_nav ); 639 640 // Sub nav items are not required. 641 if ( ! empty( $sub_nav ) ) { 642 foreach( (array) $sub_nav as $nav ) { 643 if ( ! isset( $nav['slug'], $nav['parent_slug'] ) ) { 644 continue; 645 } 646 647 if ( ! isset( $nav['rewrite_id'] ) ) { 648 $nav['rewrite_id'] = 'bp_member_' . str_replace( '-', '_', $nav['parent_slug'] ) . '_' . str_replace( '-', '_', $nav['slug'] ); 649 } elseif ( ! $nav['rewrite_id'] ) { 650 unset( $nav['rewrite_id'] ); 651 } 652 653 $this->sub_nav[] = $nav; 654 } 655 } 656 } 657 } 658 659 /** 660 * Generate component navigation using the nav/subnav set up in `BP_Component::setup_nav()`. 661 * 662 * @since 12.0.0 663 * 664 * @see bp_core_new_nav_item() For a description of the $main_nav 665 * parameter formatting. 666 * @see bp_core_new_subnav_item() For a description of how each item 667 * in the $sub_nav parameter array should be formatted. 668 */ 669 public function generate_nav() { 614 670 // No sub nav items without a main nav item. 615 if ( !empty( $main_nav ) ) { 616 // Always set the component ID. 617 $main_nav['component_id'] = $this->id; 618 619 bp_core_new_nav_item( $main_nav, 'members' ); 671 if ( $this->main_nav ) { 672 bp_core_new_nav_item( $this->main_nav, 'members' ); 620 673 621 674 // Sub nav items are not required. 622 if ( !empty( $sub_nav )) {623 foreach( (array) $ sub_nav as $nav ) {675 if ( $this->sub_nav ) { 676 foreach( (array) $this->sub_nav as $nav ) { 624 677 bp_core_new_subnav_item( $nav, 'members' ); 625 678 } -
trunk/src/bp-members/bp-members-template.php
r13441 r13442 1953 1953 * 1954 1954 * @since 1.2.4 1955 */ 1956 function bp_loggedin_user_link() { 1957 echo esc_url( bp_loggedin_user_url() ); 1955 * @since 12.0.0 Introduced the `$chunk` argument. 1956 * 1957 * @param array $chunk A list of slugs to append to the URL. 1958 */ 1959 function bp_loggedin_user_link( $chunks = array() ) { 1960 $path_chunks = array(); 1961 $chunks = (array) $chunks; 1962 1963 if ( $chunks ) { 1964 $single_item_component = array_shift( $chunks ); 1965 if ( $single_item_component ) { 1966 $path_chunks['single_item_component'] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component, $single_item_component ); 1967 } 1968 1969 $single_item_action = array_shift( $chunks ); 1970 if ( $single_item_action ) { 1971 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component . '_' . $single_item_action, $single_item_action ); 1972 } 1973 1974 if ( $chunks ) { 1975 foreach ( $chunks as $chunk ) { 1976 $path_chunks['single_item_action_variables'][] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component . '_' . $single_item_action . '_' . $chunk, $chunk ); 1977 } 1978 } 1979 } 1980 1981 echo esc_url( bp_loggedin_user_url( $path_chunks ) ); 1958 1982 } 1959 1983 -
trunk/src/bp-members/classes/class-bp-members-component.php
r13441 r13442 616 616 */ 617 617 public function get_avatar_cover_image_admin_navs( $admin_bar_menu_id = '' ) { 618 $wp_admin_nav = array(); 619 $profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() ); 618 $wp_admin_nav = array(); 619 $profile_slug = bp_get_profile_slug(); 620 $custom_profile_slug = bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ); 620 621 621 622 if ( ! $admin_bar_menu_id ) { … … 629 630 'id' => 'my-account-' . $admin_bar_menu_id . '-change-avatar', 630 631 'title' => _x( 'Change Profile Photo', 'My Account Profile sub nav', 'buddypress' ), 631 'href' => trailingslashit( $profile_link . 'change-avatar' ), 632 'position' => 30 632 'href' => bp_loggedin_user_url( 633 array( 634 'single_item_component' => $custom_profile_slug, 635 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_change_avatar', 'change-avatar' ), 636 ) 637 ), 638 'position' => 30, 633 639 ); 634 640 } … … 640 646 'id' => 'my-account-' . $admin_bar_menu_id . '-change-cover-image', 641 647 'title' => _x( 'Change Cover Image', 'My Account Profile sub nav', 'buddypress' ), 642 'href' => trailingslashit( $profile_link . 'change-cover-image' ), 643 'position' => 40 648 'href' => bp_loggedin_user_url( 649 array( 650 'single_item_component' => $custom_profile_slug, 651 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_change_cover_image', 'change-cover-image' ), 652 ) 653 ), 654 'position' => 40, 644 655 ); 645 }646 647 return $wp_admin_nav;648 }649 650 /**651 * Get the members invitations admin bar navs.652 *653 * @since 8.0.0654 *655 * @param string $admin_bar_menu_id The Admin bar menu ID to attach sub items to.656 * @return array The members invitations admin navs.657 */658 public function get_members_invitations_admin_navs( $admin_bar_menu_id = '' ) {659 $wp_admin_nav = array();660 $invite_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() );661 662 if ( ! $admin_bar_menu_id ) {663 $admin_bar_menu_id = $this->id;664 656 } 665 657 … … 677 669 // Menus for logged in user. 678 670 if ( is_user_logged_in() ) { 679 $profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() ); 671 $profile_slug = bp_get_profile_slug(); 672 $custom_profile_slug = bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ); 680 673 681 674 if ( ! bp_is_active( 'xprofile' ) ) { … … 685 678 'id' => 'my-account-' . $this->id, 686 679 'title' => _x( 'Profile', 'My Account Profile', 'buddypress' ), 687 'href' => $profile_link 680 'href' => bp_loggedin_user_url( 681 array( 682 'single_item_component' => $custom_profile_slug, 683 ) 684 ), 688 685 ); 689 686 … … 693 690 'id' => 'my-account-' . $this->id . '-public', 694 691 'title' => _x( 'View', 'My Account Profile sub nav', 'buddypress' ), 695 'href' => trailingslashit( $profile_link . 'public' ), 696 'position' => 10 692 'href' => bp_loggedin_user_url( 693 array( 694 'single_item_component' => $custom_profile_slug, 695 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_public', 'public' ), 696 ) 697 ), 698 'position' => 10, 697 699 ); 698 700 -
trunk/src/bp-messages/actions/compose.php
r13096 r13442 44 44 45 45 // Setup the link to the logged-in user's messages. 46 $member_messages = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ); 46 $message_slug = bp_get_messages_slug(); 47 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 48 $path_chunks = array( 49 'single_item_component' => $custom_message_slug, 50 ); 47 51 48 52 // Site-wide notice. … … 51 55 // Attempt to save the notice and redirect to notices. 52 56 if ( messages_send_notice( $_POST['subject'], $_POST['content'] ) ) { 53 $success = true; 54 $feedback = __( 'Notice successfully created.', 'buddypress' ); 55 $redirect_to = trailingslashit( $member_messages . 'notices' ); 57 $success = true; 58 $feedback = __( 'Notice successfully created.', 'buddypress' ); 59 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices', 'notices' ); 60 $redirect_to = bp_loggedin_user_url( $path_chunks ); 56 61 57 62 // Notice could not be sent. … … 88 93 // Send the message and redirect to it. 89 94 if ( true === is_int( $send ) ) { 90 $success = true; 91 $feedback = __( 'Message successfully sent.', 'buddypress' ); 92 $view = trailingslashit( $member_messages . 'view' ); 93 $redirect_to = trailingslashit( $view . $send ); 95 $success = true; 96 $feedback = __( 'Message successfully sent.', 'buddypress' ); 97 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_view', 'view' ); 98 $path_chunks['single_item_action_variables'] = array( $send ); 99 $redirect_to = bp_loggedin_user_url( $path_chunks ); 94 100 95 101 // Message could not be sent. -
trunk/src/bp-messages/actions/notices.php
r13096 r13442 87 87 88 88 // Redirect. 89 $member_notices = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ); 90 $redirect_to = trailingslashit( $member_notices . 'notices' ); 89 $message_slug = bp_get_messages_slug(); 90 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 91 $redirect_to = bp_loggedin_user_url( 92 array( 93 'single_item_component' => $custom_message_slug, 94 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices', 'notices' ), 95 ) 96 ); 91 97 92 98 bp_core_redirect( $redirect_to ); … … 132 138 133 139 // Redirect. 134 $redirect_to = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ); 140 $message_slug = bp_get_messages_slug(); 141 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 142 $redirect_to = bp_loggedin_user_url( 143 array( 144 'single_item_component' => $custom_message_slug, 145 ) 146 ); 135 147 136 148 bp_core_redirect( $redirect_to ); -
trunk/src/bp-messages/bp-messages-notifications.php
r13395 r13442 25 25 */ 26 26 function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { 27 $total_items = (int) $total_items; 28 $text = ''; 29 $link = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox' ); 30 $title = __( 'Inbox', 'buddypress' ); 31 $amount = 'single'; 27 $total_items = (int) $total_items; 28 $text = ''; 29 $message_slug = bp_get_messages_slug(); 30 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 31 $link = bp_loggedin_user_url( 32 array( 33 'single_item_component' => $custom_message_slug, 34 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_inbox', 'inbox' ), 35 ) 36 ); 37 $title = __( 'Inbox', 'buddypress' ); 38 $amount = 'single'; 32 39 33 40 if ( 'new_message' === $action ) { -
trunk/src/bp-messages/bp-messages-star.php
r13433 r13442 114 114 ); 115 115 116 // Check user ID and determine base user URL. 117 switch ( $r['user_id'] ) { 118 119 // Current user. 120 case bp_loggedin_user_id() : 121 $user_domain = bp_loggedin_user_domain(); 122 break; 123 124 // Displayed user. 125 case bp_displayed_user_id() : 126 $user_domain = bp_displayed_user_domain(); 127 break; 128 129 // Empty or other. 130 default : 131 $user_domain = bp_members_get_user_url( $r['user_id'] ); 132 break; 133 } 116 // Check user ID and determine base user slug. 117 $user_slug = bp_members_get_user_slug( $r['user_id'] ); 134 118 135 119 // Bail if no user domain was calculated. 136 if ( empty( $user_ domain) ) {120 if ( empty( $user_slug ) ) { 137 121 return ''; 138 122 } 123 124 $message_slug = bp_get_messages_slug(); 125 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 126 $path_chunks = array( 127 'component_id' => 'members', 128 'single_item' => $user_slug, 129 'single_item_component' => $custom_message_slug, 130 ); 139 131 140 132 // Define local variables. … … 183 175 184 176 if ( true === $is_starred ) { 185 $action = 'unstar'; 186 $bulk_attr = ' data-star-bulk="1"'; 187 $retval = $user_domain . bp_get_messages_slug() . '/unstar/' . $message_id . '/' . $nonce . '/all/'; 177 $action = 'unstar'; 178 $bulk_attr = ' data-star-bulk="1"'; 179 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_unstar', 'unstar' ); 180 $path_chunks['single_item_action_variables'] = array( $message_id, $nonce, bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_all', 'all' ) ); 188 181 } else { 189 $action = 'star'; 190 $retval = $user_domain . bp_get_messages_slug() . '/star/' . $message_id . '/' . $nonce . '/'; 182 $action = 'star'; 183 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_star', 'star' ); 184 $path_chunks['single_item_action_variables'] = array( $message_id, $nonce ); 191 185 } 192 186 … … 200 194 201 195 if ( true === $is_starred ) { 202 $action = 'unstar'; 203 $retval = $user_domain . bp_get_messages_slug() . '/unstar/' . $message_id . '/' . $nonce . '/'; 196 $action = 'unstar'; 197 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_unstar', 'unstar' ); 198 $path_chunks['single_item_action_variables'] = array( $message_id, $nonce ); 204 199 } else { 205 $action = 'star'; 206 $retval = $user_domain . bp_get_messages_slug() . '/star/' . $message_id . '/' . $nonce . '/'; 200 $action = 'star'; 201 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_star', 'star' ); 202 $path_chunks['single_item_action_variables'] = array( $message_id, $nonce ); 207 203 } 208 204 209 205 $title = $r["title_{$action}"]; 210 206 } 207 208 $url = bp_rewrites_get_url( $path_chunks ); 211 209 212 210 /** … … 215 213 * @since 2.3.0 216 214 * 217 * @param string $ retval URL for starring / unstarring a message.218 * @param array $r 215 * @param string $url URL for starring / unstarring a message. 216 * @param array $r Parsed link arguments. See $args in bp_get_the_message_star_action_link(). 219 217 */ 220 $retval = esc_url( apply_filters( 'bp_get_the_message_star_action_urlonly', $ retval, $r ) );218 $retval = esc_url( apply_filters( 'bp_get_the_message_star_action_urlonly', $url, $r ) ); 221 219 if ( true === (bool) $r['url_only'] ) { 222 220 return $retval; -
trunk/src/bp-messages/bp-messages-template.php
r13436 r13442 1335 1335 global $messages_template; 1336 1336 1337 $message_slug = bp_get_messages_slug(); 1338 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 1339 $url = wp_nonce_url( 1340 bp_loggedin_user_url( 1341 array( 1342 'single_item_component' => $custom_message_slug, 1343 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices', 'notices' ), 1344 'single_item_action_variables' => array( 1345 bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices_delete', 'delete' ), 1346 $messages_template->thread->id, 1347 ), 1348 ) 1349 ), 1350 'messages_delete_notice' 1351 ); 1352 1337 1353 /** 1338 1354 * Filters the URL for deleting the current notice. … … 1340 1356 * @since 1.0.0 1341 1357 * 1342 * @param string $value URL for deleting the current notice. 1343 * @param string $value Text indicating action being executed. 1344 */ 1345 return apply_filters( 'bp_get_message_notice_delete_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/delete/' . $messages_template->thread->id ), 'messages_delete_notice' ) ); 1358 * @param string $url URL for deleting the current notice. 1359 */ 1360 return apply_filters( 'bp_get_message_notice_delete_link', $url ); 1346 1361 } 1347 1362 … … 1362 1377 global $messages_template; 1363 1378 1379 $message_slug = bp_get_messages_slug(); 1380 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 1381 $path_chunks = array( 1382 'single_item_component' => $custom_message_slug, 1383 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices', 'notices' ), 1384 ); 1385 1364 1386 if ( 1 === (int) $messages_template->thread->is_active ) { 1365 $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/deactivate/' . $messages_template->thread->id ), 'messages_deactivate_notice' ); 1387 $nonce = 'messages_deactivate_notice'; 1388 $path_chunks['single_item_action_variables'] = array( 1389 bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices_deactivate', 'deactivate' ), 1390 $messages_template->thread->id, 1391 ); 1366 1392 } else { 1367 $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/activate/' . $messages_template->thread->id ), 'messages_activate_notice' ); 1393 $nonce = 'messages_activate_notice'; 1394 $path_chunks['single_item_action_variables'] = array( 1395 bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices_activate', 'activate' ), 1396 $messages_template->thread->id, 1397 ); 1368 1398 } 1399 1400 $link = wp_nonce_url( bp_loggedin_user_url( $path_chunks ), $nonce ); 1369 1401 1370 1402 /** … … 1425 1457 */ 1426 1458 function bp_get_message_notice_dismiss_link() { 1427 1428 $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/dismiss/' ), 'messages_dismiss_notice' ); 1459 $message_slug = bp_get_messages_slug(); 1460 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 1461 $link = wp_nonce_url( 1462 bp_loggedin_user_url( 1463 array( 1464 'single_item_component' => $custom_message_slug, 1465 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices', 'notices' ), 1466 'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices_dismiss', 'dismiss' ) ), 1467 ) 1468 ), 1469 'messages_dismiss_notice' 1470 ); 1429 1471 1430 1472 /** … … 1513 1555 } 1514 1556 1557 $message_slug = bp_get_messages_slug(); 1558 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 1559 $url = wp_nonce_url( 1560 add_query_arg( 1561 'r', 1562 bp_members_get_user_slug( bp_displayed_user_id() ), 1563 bp_loggedin_user_url( 1564 array( 1565 'single_item_component' => $custom_message_slug, 1566 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_compose', 'compose' ), 1567 ) 1568 ) 1569 1570 ) 1571 ); 1572 1515 1573 /** 1516 1574 * Filters the URL for the Private Message link in member profile headers. … … 1518 1576 * @since 1.2.10 1519 1577 * 1520 * @param string $ valueURL for the Private Message link in member profile headers.1521 */ 1522 return apply_filters( 'bp_get_send_private_message_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_members_get_user_slug( bp_displayed_user_id() ) ));1578 * @param string $url URL for the Private Message link in member profile headers. 1579 */ 1580 return apply_filters( 'bp_get_send_private_message_link', $url ); 1523 1581 } 1524 1582 -
trunk/src/bp-messages/classes/class-bp-messages-component.php
r13441 r13442 295 295 // Menus for logged in user. 296 296 if ( is_user_logged_in() ) { 297 298 // Setup the logged in user variables. 299 $messages_link = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ); 297 $message_slug = bp_get_messages_slug(); 298 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 300 299 301 300 // Unread message count. … … 322 321 'id' => 'my-account-' . $this->id, 323 322 'title' => $title, 324 'href' => $messages_link 323 'href' => bp_loggedin_user_url( 324 array( 325 'single_item_component' => $custom_message_slug, 326 ) 327 ), 325 328 ); 326 329 … … 330 333 'id' => 'my-account-' . $this->id . '-inbox', 331 334 'title' => $inbox, 332 'href' => trailingslashit( $messages_link . 'inbox' ), 333 'position' => 10 335 'href' => bp_loggedin_user_url( 336 array( 337 'single_item_component' => $custom_message_slug, 338 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_inbox', 'inbox' ), 339 ) 340 ), 341 'position' => 10, 334 342 ); 335 343 336 344 // Starred. 337 345 if ( bp_is_active( $this->id, 'star' ) ) { 346 $star_slug = bp_get_messages_starred_slug(); 338 347 $wp_admin_nav[] = array( 339 348 'parent' => 'my-account-' . $this->id, 340 349 'id' => 'my-account-' . $this->id . '-starred', 341 350 'title' => __( 'Starred', 'buddypress' ), 342 'href' => trailingslashit( $messages_link . bp_get_messages_starred_slug() ), 343 'position' => 11 351 'href' => bp_loggedin_user_url( 352 array( 353 'single_item_component' => $custom_message_slug, 354 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_' . $star_slug, $star_slug ), 355 ) 356 ), 357 'position' => 11, 344 358 ); 345 359 } … … 350 364 'id' => 'my-account-' . $this->id . '-sentbox', 351 365 'title' => __( 'Sent', 'buddypress' ), 352 'href' => trailingslashit( $messages_link . 'sentbox' ), 353 'position' => 20 366 'href' => bp_loggedin_user_url( 367 array( 368 'single_item_component' => $custom_message_slug, 369 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_sentbox', 'sentbox' ), 370 ) 371 ), 372 'position' => 20, 354 373 ); 355 374 … … 359 378 'id' => 'my-account-' . $this->id . '-compose', 360 379 'title' => __( 'Compose', 'buddypress' ), 361 'href' => trailingslashit( $messages_link . 'compose' ), 362 'position' => 30 380 'href' => bp_loggedin_user_url( 381 array( 382 'single_item_component' => $custom_message_slug, 383 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_compose', 'compose' ), 384 ) 385 ), 386 'position' => 30, 363 387 ); 364 388 … … 369 393 'id' => 'my-account-' . $this->id . '-notices', 370 394 'title' => __( 'Site Notices', 'buddypress' ), 371 'href' => trailingslashit( $messages_link . 'notices' ), 372 'position' => 90 395 'href' => bp_loggedin_user_url( 396 array( 397 'single_item_component' => $custom_message_slug, 398 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_notices', 'notices' ), 399 ) 400 ), 401 'position' => 90, 373 402 ); 374 403 } -
trunk/src/bp-messages/screens/view.php
r13395 r13442 22 22 } 23 23 24 $thread_id = (int) bp_action_variable( 0 ); 24 $thread_id = (int) bp_action_variable( 0 ); 25 $message_slug = bp_get_messages_slug(); 26 $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug ); 25 27 26 28 if ( empty( $thread_id ) || ! messages_is_valid_thread( $thread_id ) ) { … … 29 31 } 30 32 31 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ) ); 33 bp_core_redirect( 34 bp_loggedin_user_url( 35 array( 36 'single_item_component' => $custom_message_slug, 37 ) 38 ) 39 ); 32 40 } 33 41 … … 42 50 } else { 43 51 bp_core_add_message( __( 'You do not have access to that conversation.', 'buddypress' ), 'error' ); 44 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() ) ); 52 53 bp_core_redirect( 54 bp_loggedin_user_url( 55 array( 56 'single_item_component' => $custom_message_slug, 57 ) 58 ) 59 ); 45 60 } 46 61 } -
trunk/src/bp-notifications/bp-notifications-adminbar.php
r13395 r13442 33 33 $alert_class = (int) $count > 0 ? 'pending-count alert' : 'count no-alert'; 34 34 $menu_title = '<span id="ab-pending-notifications" class="' . $alert_class . '">' . number_format_i18n( $count ) . '</span>'; 35 $menu_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() ); 35 $notifications_slug = bp_get_notifications_slug(); 36 $custom_notifications_slug = bp_rewrites_get_slug( 'members', 'member_' . $notifications_slug, $notifications_slug ); 37 $menu_link = bp_loggedin_user_url( 38 array( 39 'single_item_component' => $custom_notifications_slug, 40 ) 41 ); 36 42 37 43 // Add the top-level Notifications button. -
trunk/src/bp-notifications/bp-notifications-functions.php
r13395 r13442 235 235 if ( is_string( $content ) ) { 236 236 $notification_object->content = $content; 237 $notification_object->href = bp_loggedin_user_ domain();237 $notification_object->href = bp_loggedin_user_url(); 238 238 } else { 239 239 $notification_object->content = isset( $content['text'] ) ? $content['text'] : ''; … … 303 303 if ( is_string( $content ) ) { 304 304 $notification_object->content = $content; 305 $notification_object->href = bp_loggedin_user_ domain();305 $notification_object->href = bp_loggedin_user_url(); 306 306 } else { 307 307 $notification_object->content = $content['text']; -
trunk/src/bp-notifications/classes/class-bp-notifications-component.php
r13441 r13442 221 221 // Menus for logged in user. 222 222 if ( is_user_logged_in() ) { 223 224 // Setup the logged in user variables. 225 $notifications_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() ); 223 $notifications_slug = bp_get_notifications_slug(); 224 $custom_notifications_slug = bp_rewrites_get_slug( 'members', 'member_' . $notifications_slug, $notifications_slug ); 226 225 227 226 // Pending notification requests. … … 248 247 'id' => 'my-account-' . $this->id, 249 248 'title' => $title, 250 'href' => $notifications_link, 249 'href' => bp_loggedin_user_url( 250 array( 251 'single_item_component' => $custom_notifications_slug, 252 ) 253 ), 251 254 ); 252 255 … … 256 259 'id' => 'my-account-' . $this->id . '-unread', 257 260 'title' => $unread, 258 'href' => trailingslashit( $notifications_link . 'unread' ), 261 'href' => bp_loggedin_user_url( 262 array( 263 'single_item_component' => $custom_notifications_slug, 264 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $notifications_slug . '_unread', 'unread' ), 265 ) 266 ), 259 267 'position' => 10, 260 268 ); … … 265 273 'id' => 'my-account-' . $this->id . '-read', 266 274 'title' => _x( 'Read', 'My Account Notification sub nav', 'buddypress' ), 267 'href' => trailingslashit( $notifications_link . 'read' ), 275 'href' => bp_loggedin_user_url( 276 array( 277 'single_item_component' => $custom_notifications_slug, 278 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $notifications_slug . '_read', 'read' ), 279 ) 280 ), 268 281 'position' => 20, 269 282 ); -
trunk/src/bp-settings/classes/class-bp-settings-component.php
r13441 r13442 235 235 // Menus for logged in user. 236 236 if ( is_user_logged_in() ) { 237 238 // Setup the logged in user variables. 239 $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() ); 237 $settings_slug = bp_get_settings_slug(); 238 $custom_settings_slug = bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug ); 240 239 241 240 // Add main Settings menu. … … 244 243 'id' => 'my-account-' . $this->id, 245 244 'title' => __( 'Settings', 'buddypress' ), 246 'href' => $settings_link, 245 'href' => bp_loggedin_user_url( 246 array( 247 'single_item_component' => $custom_settings_slug, 248 ) 249 ), 247 250 ); 248 251 … … 252 255 'id' => 'my-account-' . $this->id . '-general', 253 256 'title' => __( 'General', 'buddypress' ), 254 'href' => trailingslashit( $settings_link . 'general' ), 257 'href' => bp_loggedin_user_url( 258 array( 259 'single_item_component' => $custom_settings_slug, 260 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_general', 'general' ), 261 ) 262 ), 255 263 'position' => 10, 256 264 ); … … 262 270 'id' => 'my-account-' . $this->id . '-notifications', 263 271 'title' => __( 'Email', 'buddypress' ), 264 'href' => trailingslashit( $settings_link . 'notifications' ), 272 'href' => bp_loggedin_user_url( 273 array( 274 'single_item_component' => $custom_settings_slug, 275 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_notifications', 'notifications' ), 276 ) 277 ), 265 278 'position' => 20, 266 279 ); … … 276 289 'id' => 'my-account-' . $this->id . '-data', 277 290 'title' => __( 'Export Data', 'buddypress' ), 278 'href' => trailingslashit( $settings_link . 'data' ), 291 'href' => bp_loggedin_user_url( 292 array( 293 'single_item_component' => $custom_settings_slug, 294 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_data', 'data' ), 295 ) 296 ), 279 297 'position' => 89, 280 298 ); … … 287 305 'id' => 'my-account-' . $this->id . '-delete-account', 288 306 'title' => __( 'Delete Account', 'buddypress' ), 289 'href' => trailingslashit( $settings_link . 'delete-account' ), 307 'href' => bp_loggedin_user_url( 308 array( 309 'single_item_component' => $custom_settings_slug, 310 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_delete_account', 'delete-account' ), 311 ) 312 ), 290 313 'position' => 90, 291 314 ); -
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r13437 r13442 7 7 * @package BuddyPress 8 8 * @subpackage BP_Theme_Compat 9 * @version 1 0.0.09 * @version 12.0.0 10 10 */ 11 11 … … 908 908 909 909 $scope = ''; 910 if ( ! empty( $_POST['scope'] ) ) 910 if ( ! empty( $_POST['scope'] ) ) { 911 911 $scope = $_POST['scope']; 912 } 913 914 $activity_slug = bp_get_activity_slug(); 915 $custom_activity_slug = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ); 912 916 913 917 // We need to calculate and return the feed URL for each scope. 914 918 switch ( $scope ) { 915 919 case 'friends': 916 $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/friends/feed/'; 920 $feed_url = bp_loggedin_user_url( 921 array( 922 'single_item_component' => $custom_activity_slug, 923 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_friends', 'friends' ), 924 'single_item_action_variables' => array( 'feed' ), 925 ) 926 ); 917 927 break; 918 928 case 'groups': 919 $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/groups/feed/'; 929 $feed_url = bp_loggedin_user_url( 930 array( 931 'single_item_component' => $custom_activity_slug, 932 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_groups', 'groups' ), 933 'single_item_action_variables' => array( 'feed' ), 934 ) 935 ); 920 936 break; 921 937 case 'favorites': 922 $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/feed/'; 938 $feed_url = bp_loggedin_user_url( 939 array( 940 'single_item_component' => $custom_activity_slug, 941 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ), 942 'single_item_action_variables' => array( 'feed' ), 943 ) 944 ); 923 945 break; 924 946 case 'mentions': 925 $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/'; 947 $feed_url = bp_loggedin_user_url( 948 array( 949 'single_item_component' => $custom_activity_slug, 950 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_mentions', 'mentions' ), 951 'single_item_action_variables' => array( 'feed' ), 952 ) 953 ); 926 954 927 955 if ( isset( $_POST['_wpnonce_activity_filter'] ) && wp_verify_nonce( wp_unslash( $_POST['_wpnonce_activity_filter'] ), 'activity_filter' ) ) { … … 1454 1482 } 1455 1483 1484 $friends_slug = bp_get_friends_slug(); 1485 $custom_friends_slug = bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ); 1486 1456 1487 // Trying to cancel friendship. 1457 1488 if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $friend_id ) ) { … … 1461 1492 echo __( 'Friendship could not be canceled.', 'buddypress' ); 1462 1493 } else { 1463 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="friendship-button not_friends add" rel="add" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $friend_id, 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 1494 $url = bp_loggedin_user_url( 1495 array( 1496 'single_item_component' => $custom_friends_slug, 1497 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_add_friend', 'add-friend' ), 1498 'single_item_action_variables' => array( $friend_id ), 1499 ) 1500 ); 1501 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="friendship-button not_friends add" rel="add" href="' . wp_nonce_url( $url, 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 1464 1502 } 1465 1503 … … 1471 1509 echo __(' Friendship could not be requested.', 'buddypress' ); 1472 1510 } else { 1473 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="remove friendship-button pending_friend requested" rel="remove" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $friend_id . '/', 'friends_withdraw_friendship' ) . '" class="requested">' . __( 'Cancel Friendship Request', 'buddypress' ) . '</a>'; 1511 $url = bp_loggedin_user_url( 1512 array( 1513 'single_item_component' => $custom_friends_slug, 1514 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 1515 'single_item_action_variables' => array( 1516 bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests_cancel', 'cancel' ), 1517 $friend_id, 1518 ), 1519 ) 1520 ); 1521 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="remove friendship-button pending_friend requested" rel="remove" href="' . wp_nonce_url( $url, 'friends_withdraw_friendship' ) . '" class="requested">' . __( 'Cancel Friendship Request', 'buddypress' ) . '</a>'; 1474 1522 } 1475 1523 … … 1479 1527 1480 1528 if ( friends_withdraw_friendship( bp_loggedin_user_id(), $friend_id ) ) { 1481 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="friendship-button not_friends add" rel="add" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $friend_id, 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 1529 $url = bp_loggedin_user_url( 1530 array( 1531 'single_item_component' => $custom_friends_slug, 1532 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_add_friend', 'add-friend' ), 1533 'single_item_action_variables' => array( 1534 $friend_id, 1535 ), 1536 ) 1537 ); 1538 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="friendship-button not_friends add" rel="add" href="' . wp_nonce_url( $url, 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 1482 1539 } else { 1483 1540 echo __("Friendship request could not be cancelled.", 'buddypress'); -
trunk/src/bp-templates/bp-legacy/buddypress/activity/index.php
r12907 r13442 7 7 * @package BuddyPress 8 8 * @subpackage bp-legacy 9 * @version 3.0.09 * @version 12.0.0 10 10 */ 11 11 … … 82 82 83 83 <li id="activity-friends"> 84 <a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/'; ?>">84 <a href="<?php bp_loggedin_user_link( array( bp_get_activity_slug(), bp_get_friends_slug() ) ); ?>"> 85 85 <?php 86 86 /* translators: %s: number of friends */ 87 printf( __( 'My Friends %s', 'buddypress' ), '<span>' . bp_get_total_friend_count( bp_loggedin_user_id() ) . '</span>' );87 printf( esc_html__( 'My Friends %s', 'buddypress' ), '<span>' . bp_get_total_friend_count( bp_loggedin_user_id() ) . '</span>' ); 88 88 ?> 89 89 </a> … … 107 107 <?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?> 108 108 109 <?php 110 printf( 111 '<li id="activity-groups"><a href="%1$s">%2$s</a></li>', 112 esc_url( bp_loggedin_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/' ), 113 sprintf( 109 <li id="activity-groups"> 110 <a href="<?php bp_loggedin_user_link( array( bp_get_activity_slug(), bp_get_groups_slug() ) ); ?>"> 111 <?php 114 112 /* translators: %s: current user groups count */ 115 __( 'My Groups %s', 'buddypress' ), 116 '<span>' . bp_get_total_group_count_for_user( bp_loggedin_user_id() ) . '</span>' 117 ) 118 ); 119 ?> 113 printf( esc_html__( 'My Groups %s', 'buddypress' ), '<span>' . bp_get_total_group_count_for_user( bp_loggedin_user_id() ) . '</span>' ); 114 ?> 115 </a> 116 </li> 120 117 121 118 <?php endif; ?> … … 135 132 136 133 <li id="activity-favorites"> 137 <a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/'; ?>">134 <a href="<?php bp_loggedin_user_link( array( bp_get_activity_slug(), 'favorites' ) ); ?>"> 138 135 <?php 139 136 /* translators: %s: number of favorites */ 140 printf( __( 'My Favorites %s', 'buddypress' ), '<span>' . bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) . '</span>' );137 printf( esc_html__( 'My Favorites %s', 'buddypress' ), '<span>' . bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) . '</span>' ); 141 138 ?> 142 139 </a> … … 157 154 158 155 <li id="activity-mentions"> 159 <a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?>">160 <?php _e( 'Mentions', 'buddypress' ); ?>156 <a href="<?php bp_loggedin_user_link( array( bp_get_activity_slug(), 'mentions' ) ); ?>"> 157 <?php esc_html_e( 'Mentions', 'buddypress' ); ?> 161 158 <?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> 162 159 … … 165 162 <?php 166 163 /* translators: %s: new mentions count */ 167 printf( _nx( '%s new', '%s new', bp_get_total_mention_count_for_user( bp_loggedin_user_id() ), 'Number of new activity mentions', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) );164 printf( esc_html( _nx( '%s new', '%s new', bp_get_total_mention_count_for_user( bp_loggedin_user_id() ), 'Number of new activity mentions', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ); 168 165 ?> 169 166 </span> -
trunk/src/bp-templates/bp-legacy/buddypress/activity/post-form.php
r12595 r13442 5 5 * @package BuddyPress 6 6 * @subpackage bp-legacy 7 * @version 3.0.07 * @version 12.0.0 8 8 */ 9 9 … … 22 22 23 23 <div id="whats-new-avatar"> 24 <a href="<?php echo bp_loggedin_user_domain(); ?>">24 <a href="<?php bp_loggedin_user_link(); ?>"> 25 25 <?php bp_loggedin_user_avatar( 'width=' . bp_core_avatar_thumb_width() . '&height=' . bp_core_avatar_thumb_height() ); ?> 26 26 </a> -
trunk/src/bp-templates/bp-legacy/buddypress/blogs/index.php
r13033 r13442 5 5 * @package BuddyPress 6 6 * @subpackage bp-legacy 7 * @version 1 0.0.07 * @version 12.0.0 8 8 */ 9 9 … … 72 72 73 73 <li id="blogs-personal"> 74 <a href="<?php echo bp_loggedin_user_domain() . bp_get_blogs_slug(); ?>">74 <a href="<?php bp_loggedin_user_link( array( bp_get_blogs_slug() ) ); ?>"> 75 75 <?php 76 76 /* translators: %s: current user blogs count */ -
trunk/src/bp-templates/bp-legacy/buddypress/groups/index.php
r13437 r13442 71 71 <?php if ( is_user_logged_in() && bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?> 72 72 <li id="groups-personal"> 73 <a href="<?php echo bp_loggedin_user_domain() . bp_get_groups_slug() . '/my-groups/'; ?>">73 <a href="<?php bp_loggedin_user_link( array( bp_get_groups_slug(), 'my-groups' ) ); ?>"> 74 74 <?php 75 75 /* translators: %s: current user groups count */ -
trunk/src/bp-templates/bp-legacy/buddypress/members/index.php
r12082 r13442 5 5 * @package BuddyPress 6 6 * @subpackage bp-legacy 7 * @version 3.0.07 * @version 12.0.0 8 8 */ 9 9 … … 63 63 64 64 <?php if ( is_user_logged_in() && bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?> 65 <li id="members-personal"><a href="<?php echo esc_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/'); ?>"><?php printf( __( 'My Friends %s', 'buddypress' ), '<span>' . bp_get_total_friend_count( bp_loggedin_user_id() ) . '</span>' ); ?></a></li>65 <li id="members-personal"><a href="<?php bp_loggedin_user_link( array( bp_get_friends_slug(), 'my-friends' ) ); ?>"><?php printf( __( 'My Friends %s', 'buddypress' ), '<span>' . bp_get_total_friend_count( bp_loggedin_user_id() ) . '</span>' ); ?></a></li> 66 66 <?php endif; ?> 67 67 -
trunk/src/bp-templates/bp-nouveau/includes/activity/ajax.php
r13433 r13442 4 4 * 5 5 * @since 3.0.0 6 * @version 1 0.0.06 * @version 12.0.0 7 7 */ 8 8 … … 115 115 116 116 if ( 1 === $fav_count ) { 117 $activity_slug = bp_nouveau_get_component_slug( 'activity' ); 118 $custom_activity_slug = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ); 119 $activity_favorites_url = bp_loggedin_user_url( 120 array( 121 'single_item_component' => $custom_activity_slug, 122 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ), 123 ) 124 ); 125 117 126 $response['directory_tab'] = '<li id="activity-favorites" data-bp-scope="favorites" data-bp-object="activity"> 118 <a href="' . bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/favorites/">127 <a href="' . esc_url( $activity_favorites_url ). '"> 119 128 ' . esc_html__( 'My Favorites', 'buddypress' ) . ' 120 129 </a> -
trunk/src/bp-templates/bp-nouveau/includes/activity/functions.php
r12908 r13442 4 4 * 5 5 * @since 3.0.0 6 * @version 8.0.06 * @version 12.0.0 7 7 */ 8 8 … … 88 88 'avatar_width' => $width, 89 89 'avatar_height' => $height, 90 'user_domain' => bp_loggedin_user_ domain(),90 'user_domain' => bp_loggedin_user_url(), 91 91 'avatar_alt' => sprintf( 92 92 /* translators: %s: member name */ … … 220 220 ) 221 221 ); 222 $activity_slug = bp_nouveau_get_component_slug( 'activity' ); 223 $path_chunks = array( 224 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ), 225 ); 222 226 223 227 // If the user has favorite create a nav item 224 228 if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) { 229 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ); 230 225 231 $nav_items['favorites'] = array( 226 232 'component' => 'activity', 227 233 'slug' => 'favorites', // slug is used because BP_Core_Nav requires it, but it's the scope 228 234 'li_class' => array(), 229 'link' => bp_loggedin_user_ domain() . bp_nouveau_get_component_slug( 'activity' ) . '/favorites/',235 'link' => bp_loggedin_user_url( $path_chunks ), 230 236 'text' => __( 'My Favorites', 'buddypress' ), 231 237 'count' => false, … … 236 242 // The friends component is active and user has friends 237 243 if ( bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) { 244 $friends_slug = bp_nouveau_get_component_slug( 'friends' ); 245 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_' . $friends_slug, $friends_slug ); 246 238 247 $nav_items['friends'] = array( 239 248 'component' => 'activity', 240 249 'slug' => 'friends', // slug is used because BP_Core_Nav requires it, but it's the scope 241 250 'li_class' => array( 'dynamic' ), 242 'link' => bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/' . bp_nouveau_get_component_slug( 'friends' ) . '/',251 'link' => bp_loggedin_user_url( $path_chunks ), 243 252 'text' => __( 'My Friends', 'buddypress' ), 244 253 'count' => '', … … 249 258 // The groups component is active and user has groups 250 259 if ( bp_is_active( 'groups' ) && bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) { 260 $groups_slug = bp_nouveau_get_component_slug( 'groups' ); 261 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_' . $groups_slug, $groups_slug ); 262 251 263 $nav_items['groups'] = array( 252 264 'component' => 'activity', 253 265 'slug' => 'groups', // slug is used because BP_Core_Nav requires it, but it's the scope 254 266 'li_class' => array( 'dynamic' ), 255 'link' => bp_loggedin_user_ domain() . bp_nouveau_get_component_slug( 'activity' ) . '/' . bp_nouveau_get_component_slug( 'groups' ) . '/',267 'link' => bp_loggedin_user_url( $path_chunks ), 256 268 'text' => __( 'My Groups', 'buddypress' ), 257 269 'count' => '', … … 262 274 // Mentions are allowed 263 275 if ( bp_activity_do_mentions() ) { 264 $deprecated_hooks[] = array( 'bp_before_activity_type_tab_mentions', 'activity', 36 ); 276 $deprecated_hooks[] = array( 'bp_before_activity_type_tab_mentions', 'activity', 36 ); 277 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_mentions', 'mentions' ); 265 278 266 279 $count = ''; … … 273 286 'slug' => 'mentions', // slug is used because BP_Core_Nav requires it, but it's the scope 274 287 'li_class' => array( 'dynamic' ), 275 'link' => bp_loggedin_user_ domain() . bp_nouveau_get_component_slug( 'activity' ) . '/mentions/',288 'link' => bp_loggedin_user_url( $path_chunks ), 276 289 'text' => __( 'Mentions', 'buddypress' ), 277 290 'count' => $count, -
trunk/src/bp-templates/bp-nouveau/includes/ajax.php
r13136 r13442 4 4 * 5 5 * @since 3.0.0 6 * @version 1 0.0.06 * @version 12.0.0 7 7 */ 8 8 … … 54 54 } 55 55 56 $activity_slug = bp_nouveau_get_component_slug( 'activity' ); 57 $custom_activity_slug = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ); 58 56 59 // We need to calculate and return the feed URL for each scope. 57 60 switch ( $scope ) { 58 61 case 'friends': 59 $feed_url = bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/friends/feed/'; 62 $feed_url = bp_loggedin_user_url( 63 array( 64 'single_item_component' => $custom_activity_slug, 65 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_friends', 'friends' ), 66 'single_item_action_variables' => array( 'feed' ), 67 ) 68 ); 60 69 break; 61 70 case 'groups': 62 $feed_url = bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/groups/feed/'; 71 $feed_url = bp_loggedin_user_url( 72 array( 73 'single_item_component' => $custom_activity_slug, 74 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_groups', 'groups' ), 75 'single_item_action_variables' => array( 'feed' ), 76 ) 77 ); 63 78 break; 64 79 case 'favorites': 65 $feed_url = bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/favorites/feed/'; 80 $feed_url = bp_loggedin_user_url( 81 array( 82 'single_item_component' => $custom_activity_slug, 83 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ), 84 'single_item_action_variables' => array( 'feed' ), 85 ) 86 ); 66 87 break; 67 88 case 'mentions': 68 $feed_url = bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/mentions/feed/'; 89 $feed_url = bp_loggedin_user_url( 90 array( 91 'single_item_component' => $custom_activity_slug, 92 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_mentions', 'mentions' ), 93 'single_item_action_variables' => array( 'feed' ), 94 ) 95 ); 69 96 70 97 // Get user new mentions -
trunk/src/bp-templates/bp-nouveau/includes/blogs/functions.php
r13436 r13442 28 28 if ( is_user_logged_in() ) { 29 29 $my_blogs_count = bp_get_total_blog_count_for_user( bp_loggedin_user_id() ); 30 $blogs_slug = bp_nouveau_get_component_slug( 'blogs' ); 31 $path_chunks = array( 32 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $blogs_slug, $blogs_slug ), 33 ); 30 34 31 35 // If the user has blogs create a nav item … … 35 39 'slug' => 'personal', // slug is used because BP_Core_Nav requires it, but it's the scope 36 40 'li_class' => array(), 37 'link' => bp_loggedin_user_ domain() . bp_nouveau_get_component_slug( 'blogs'),41 'link' => bp_loggedin_user_url( $path_chunks ), 38 42 'text' => __( 'My Sites', 'buddypress' ), 39 43 'count' => $my_blogs_count, -
trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php
r13441 r13442 4 4 * 5 5 * @since 3.0.0 6 * @version 1 0.0.06 * @version 12.0.0 7 7 */ 8 8 … … 457 457 function bp_nouveau_groups_invites_restriction_admin_nav( $wp_admin_nav ) { 458 458 // Setup the logged in user variables. 459 $settings_ link = trailingslashit( bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'settings' ));459 $settings_slug = bp_nouveau_get_component_slug( 'settings' ); 460 460 461 461 // Add the "Group Invites" subnav item. … … 464 464 'id' => 'my-account-' . buddypress()->settings->id . '-invites', 465 465 'title' => _x( 'Group Invites', 'Group invitations main menu title', 'buddypress' ), 466 'href' => trailingslashit( $settings_link . 'invites/' ), 466 'href' => bp_loggedin_user_url( 467 array( 468 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug ), 469 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_invites', 'invites' ), 470 ) 471 ), 467 472 ); 468 473 … … 562 567 563 568 if ( is_user_logged_in() ) { 564 565 569 $my_groups_count = bp_get_total_group_count_for_user( bp_loggedin_user_id() ); 570 $groups_slug = bp_nouveau_get_component_slug( 'groups' ); 571 $path_chunks = array( 572 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ), 573 ); 566 574 567 575 // If the user has groups create a nav item 568 576 if ( $my_groups_count ) { 577 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_my_groups', 'my-groups' ); 578 569 579 $nav_items['personal'] = array( 570 580 'component' => 'groups', 571 581 'slug' => 'personal', // slug is used because BP_Core_Nav requires it, but it's the scope 572 582 'li_class' => array(), 573 'link' => bp_loggedin_user_ domain() . bp_nouveau_get_component_slug( 'groups' ) . '/my-groups/',583 'link' => bp_loggedin_user_url( $path_chunks ), 574 584 'text' => __( 'My Groups', 'buddypress' ), 575 585 'count' => $my_groups_count, -
trunk/src/bp-templates/bp-nouveau/includes/members/functions.php
r13301 r13442 78 78 // If friends component is active and the user has friends 79 79 if ( bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) { 80 $friends_slug = bp_nouveau_get_component_slug( 'friends' ); 81 $path_chunks = array( 82 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ), 83 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ), 84 ); 85 80 86 $nav_items['personal'] = array( 81 87 'component' => 'members', 82 88 'slug' => 'personal', // slug is used because BP_Core_Nav requires it, but it's the scope 83 89 'li_class' => array(), 84 'link' => bp_loggedin_user_ domain() . bp_nouveau_get_component_slug( 'friends' ) . '/my-friends/',90 'link' => bp_loggedin_user_url( $path_chunks ), 85 91 'text' => __( 'My Friends', 'buddypress' ), 86 92 'count' => bp_get_total_friend_count( bp_loggedin_user_id() ), -
trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php
r13441 r13442 210 210 211 211 /** 212 * @since 3.0.0 212 * Replaces the Notices Compose URL. 213 * 214 * @since 3.0.0 215 * 216 * @param array $admin_nav The WP Admin Nav. 213 217 */ 214 218 function bp_nouveau_messages_adjust_admin_nav( $admin_nav ) { … … 217 221 } 218 222 219 $user_messages_link = trailingslashit( bp_loggedin_user_domain() . bp_nouveau_get_component_slug( 'messages' ) );220 221 223 foreach ( $admin_nav as $nav_iterator => $nav ) { 222 224 $nav_id = str_replace( 'my-account-messages-', '', $nav['id'] ); 223 225 224 226 if ( 'notices' === $nav_id ) { 225 $admin_nav[ $nav_iterator ]['href'] = esc_url( add_query_arg( array( 226 'page' => 'bp-notices' 227 ), bp_get_admin_url( 'users.php' ) ) ); 227 $admin_nav[ $nav_iterator ]['href'] = esc_url( 228 add_query_arg( 229 array( 230 'page' => 'bp-notices', 231 ), 232 bp_get_admin_url( 'users.php' ) 233 ) 234 ); 228 235 } 229 236 } … … 271 278 'total_count' => 1, 272 279 'content' => __( 'New sitewide notice', 'buddypress' ), 273 'href' => bp_loggedin_user_ domain(),280 'href' => bp_loggedin_user_url(), 274 281 ); 275 282 -
trunk/src/bp-xprofile/classes/class-bp-xprofile-component.php
r13441 r13442 316 316 // Menus for logged in user. 317 317 if ( is_user_logged_in() ) { 318 319 // Profile link. 320 $profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() ); 318 $profile_slug = bp_get_profile_slug(); 319 $path_chunks = array( 320 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ), 321 ); 321 322 322 323 // Add the "Profile" sub menu. … … 325 326 'id' => 'my-account-' . $this->id, 326 327 'title' => _x( 'Profile', 'My Account Profile', 'buddypress' ), 327 'href' => $profile_link,328 'href' => bp_loggedin_user_url( $path_chunks ), 328 329 ); 330 331 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_public', 'public' ); 329 332 330 333 // View Profile. … … 333 336 'id' => 'my-account-' . $this->id . '-public', 334 337 'title' => _x( 'View', 'My Account Profile sub nav', 'buddypress' ), 335 'href' => trailingslashit( $profile_link . 'public'),338 'href' => bp_loggedin_user_url( $path_chunks ), 336 339 'position' => 10, 337 340 ); 341 342 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit', 'edit' ); 338 343 339 344 // Edit Profile. … … 342 347 'id' => 'my-account-' . $this->id . '-edit', 343 348 'title' => _x( 'Edit', 'My Account Profile sub nav', 'buddypress' ), 344 'href' => trailingslashit( $profile_link . 'edit'),349 'href' => bp_loggedin_user_url( $path_chunks ), 345 350 'position' => 20, 346 351 ); … … 417 422 418 423 // Setup the logged in user variables. 419 $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() ); 424 $settings_slug = bp_get_settings_slug(); 425 $path_chunks = array( 426 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug ), 427 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_profile', 'profile' ), 428 ); 420 429 421 430 // Add the "Profile" subnav item. … … 424 433 'id' => 'my-account-' . buddypress()->settings->id . '-profile', 425 434 'title' => _x( 'Profile', 'My Account Settings sub nav', 'buddypress' ), 426 'href' => trailingslashit( $settings_link . 'profile'),435 'href' => bp_loggedin_user_url( $path_chunks ), 427 436 ); 428 437 -
trunk/tests/phpunit/includes/testcase.php
r13436 r13442 192 192 $GLOBALS['bp']->loggedin_user = NULL; 193 193 $GLOBALS['bp']->pages = bp_core_get_directory_pages(); 194 195 foreach ( array_keys( bp_core_get_active_components() ) as $component ) { 196 $GLOBALS['bp']->{$component}->main_nav = array(); 197 $GLOBALS['bp']->{$component}->sub_nav = array(); 198 } 194 199 195 200 parent::go_to( $url ); -
trunk/tests/phpunit/testcases/core/class-bp-walker-nav-menu.php
r13314 r13442 29 29 'name' => 'Activity', 30 30 'slug' => 'activity', 31 'link' => trailingslashit( bp_loggedin_user_domain() . bp_get_activity_slug() ),31 'link' => bp_loggedin_user_url( array( 'single_item_component' => bp_get_activity_slug() ) ), 32 32 'css_id' => 'activity', 33 33 'class' => array( $expected[0] ), … … 37 37 'name' => 'Profile', 38 38 'slug' => 'profile', 39 'link' => trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() ),39 'link' => bp_loggedin_user_url( array( 'single_item_component' => bp_get_profile_slug() ) ), 40 40 'css_id' => 'xprofile', 41 41 'class' => array( $expected[1] ),
Note: See TracChangeset
for help on using the changeset viewer.