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

    r13432 r13441  
    147147    public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    148148
    149         // Determine user to use.
    150         if ( bp_displayed_user_domain() ) {
    151             $user_domain = bp_displayed_user_domain();
    152         } elseif ( bp_loggedin_user_domain() ) {
    153             $user_domain = bp_loggedin_user_domain();
    154         } else {
     149        // Stop if there is no user displayed or logged in.
     150        if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) {
    155151            return;
    156152        }
    157153
    158         $access             = bp_core_can_edit_settings();
    159         $slug               = bp_get_notifications_slug();
    160         $notifications_link = trailingslashit( $user_domain . $slug );
     154        $access = bp_core_can_edit_settings();
     155        $slug   = bp_get_notifications_slug();
    161156
    162157        // Only grab count if we're on a user page and current user has access.
     
    192187            'name'            => _x( 'Unread', 'Notification screen nav', 'buddypress' ),
    193188            'slug'            => 'unread',
    194             'parent_url'      => $notifications_link,
    195189            'parent_slug'     => $slug,
    196190            'screen_function' => 'bp_notifications_screen_unread',
     
    203197            'name'            => _x( 'Read', 'Notification screen nav', 'buddypress' ),
    204198            'slug'            => 'read',
    205             'parent_url'      => $notifications_link,
    206199            'parent_slug'     => $slug,
    207200            'screen_function' => 'bp_notifications_screen_read',
Note: See TracChangeset for help on using the changeset viewer.