Skip to:
Content

BuddyPress.org


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

    r13435 r13441  
    197197    public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    198198
    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() ) {
    205201            return;
    206202        }
    207203
    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();
    211206
    212207        // Only grab count if we're on a user page and current user has access.
     
    242237            'name'            => __( 'Inbox', 'buddypress' ),
    243238            'slug'            => 'inbox',
    244             'parent_url'      => $messages_link,
    245239            'parent_slug'     => $slug,
    246240            'screen_function' => 'messages_screen_inbox',
     
    253247                'name'            => __( 'Starred', 'buddypress' ),
    254248                'slug'            => bp_get_messages_starred_slug(),
    255                 'parent_url'      => $messages_link,
    256249                'parent_slug'     => $slug,
    257250                'screen_function' => 'bp_messages_star_screen',
     
    264257            'name'            => __( 'Sent', 'buddypress' ),
    265258            'slug'            => 'sentbox',
    266             'parent_url'      => $messages_link,
    267259            'parent_slug'     => $slug,
    268260            'screen_function' => 'messages_screen_sentbox',
     
    275267            'name'            => __( 'Compose', 'buddypress' ),
    276268            'slug'            => 'compose',
    277             'parent_url'      => $messages_link,
    278269            'parent_slug'     => $slug,
    279270            'screen_function' => 'messages_screen_compose',
     
    286277            'name'            => __( 'Notices', 'buddypress' ),
    287278            'slug'            => 'notices',
    288             'parent_url'      => $messages_link,
    289279            'parent_slug'     => $slug,
    290280            'screen_function' => 'messages_screen_notices',
Note: See TracChangeset for help on using the changeset viewer.