Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/23/2023 07:35:38 PM (18 months 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-settings/classes/class-bp-settings-component.php

    r13432 r13441  
    133133    public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    134134
    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() ) {
    141137            return;
    142138        }
    143139
    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();
    147142
    148143        // Add the settings navigation item.
     
    160155            'name'            => __( 'General', 'buddypress' ),
    161156            'slug'            => 'general',
    162             'parent_url'      => $settings_link,
    163157            'parent_slug'     => $slug,
    164158            'screen_function' => 'bp_settings_screen_general',
     
    172166            'name'            => __( 'Email', 'buddypress' ),
    173167            'slug'            => 'notifications',
    174             'parent_url'      => $settings_link,
    175168            'parent_slug'     => $slug,
    176169            'screen_function' => 'bp_settings_screen_notification',
     
    184177                'name'            => __( 'Capabilities', 'buddypress' ),
    185178                'slug'            => 'capabilities',
    186                 'parent_url'      => $settings_link,
    187179                'parent_slug'     => $slug,
    188180                'screen_function' => 'bp_settings_screen_capabilities',
     
    206198                'name'            => __( 'Export Data', 'buddypress' ),
    207199                'slug'            => 'data',
    208                 'parent_url'      => $settings_link,
    209200                'parent_slug'     => $slug,
    210201                'screen_function' => 'bp_settings_screen_data',
     
    219210                'name'            => __( 'Delete Account', 'buddypress' ),
    220211                'slug'            => 'delete-account',
    221                 'parent_url'      => $settings_link,
    222212                'parent_slug'     => $slug,
    223213                'screen_function' => 'bp_settings_screen_delete_account',
Note: See TracChangeset for help on using the changeset viewer.