Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/23/2023 07:35:38 PM (4 years ago)
Author:
imath
Message:

Make BP_Core_Nav generate "BP Rewrites ready" navigation links

  • Remove all components $parent_url attributes when setting sub nav items.
  • Only use the bp_core_create_nav_link() $link attribute argument & the bp_core_create_subnav_link() $parent_url attribute argument if specified to preserve backward compatibility.
  • Migrates the Community search feature so that it uses BP Rewrites.
  • Perform some bp_loggedin_user_domain() in favor of bp_loggedin_user_url().
  • Update some PHPUnit tests.

Props r-a-y, johnjamesjacoby, boonebgorges

Closes ​https://github.com/buddypress/buddypress/pull/77
See #4954

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/bp-friends-notifications.php

    r13092 r13441  
    2929 */
    3030function 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 );
    3133
    3234        switch ( $action ) {
    3335                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                        );
    3542
    3643                        // $action and $amount are used to generate dynamic filter names.
    … …  
    5158
    5259                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                        );
    5470
    5571                        $action = 'request';
Note: See TracChangeset for help on using the changeset viewer.