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-members/classes/class-bp-members-component.php

    r13437 r13441  
    429429        $subnavs = array();
    430430
    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();
    434433
    435434        // Change Avatar.
     
    438437                'name'            => _x( 'Change Profile Photo', 'Profile header sub menu', 'buddypress' ),
    439438                'slug'            => 'change-avatar',
    440                 'parent_url'      => $profile_link,
    441439                'parent_slug'     => $slug,
    442440                'screen_function' => 'bp_members_screen_change_avatar',
     
    451449                'name'            => _x( 'Change Cover Image', 'Profile header sub menu', 'buddypress' ),
    452450                'slug'            => 'change-cover-image',
    453                 'parent_url'      => $profile_link,
    454451                'parent_slug'     => $slug,
    455452                'screen_function' => 'bp_members_screen_change_cover_image',
     
    486483        if ( ! bp_displayed_user_has_front_template() && $is_xprofile_active ) {
    487484            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 {
    497485            return;
    498486        }
     
    534522            'name'            => _x( 'View', 'Member profile view', 'buddypress' ),
    535523            'slug'            => 'public',
    536             'parent_url'      => trailingslashit( $user_domain . $slug ),
    537524            'parent_slug'     => $slug,
    538525            'screen_function' => 'bp_members_screen_display_profile',
     
    556543            $front_subnav = $this->sub_nav;
    557544            $front_subnav['parent_slug'] = 'front';
    558 
    559             // In case the subnav is displayed in the front template
    560             $front_subnav['parent_url'] = trailingslashit( $user_domain . 'front' );
    561545
    562546            // Set the subnav
Note: See TracChangeset for help on using the changeset viewer.