Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/31/2023 05:26:39 PM (13 months ago)
Author:
imath
Message:

Make sure all displayed user URLs are built using the BP Rewrites API

Replace all remaining bp_displayed_user_domain() usage in favor of
bp_displayed_user_url().
Introduce the bp_members_get_path_chunks() function to quickly build BP
Rewrites argument for member's URL using an array of slugs.
Deprecate bp_activities_member_rss_link(), bp_blogs_blog_tabs() &
bp_groups_header_tabs().
Improve bp_displayed_user_link() so that it's possible to pass an array
of slugs to output an escaped BP Rewrites ready URL.

Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-buddybar.php

    r13441 r13443  
    751751                if ( bp_is_my_profile() || ( isset( $parent_nav_default_item ) && $parent_nav_default_item->show_for_displayed_user ) ) {
    752752                    $message     = __( 'You do not have access to that page.', 'buddypress' );
    753                     $redirect_to = bp_displayed_user_domain();
     753                    $redirect_to = bp_displayed_user_url();
    754754
    755755                // In some cases, the default tab is not accessible to
     
    759759                    // Try 'activity' first.
    760760                    if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) {
    761                         $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() );
     761                        $activity_slug = bp_get_activity_slug();
     762                        $redirect_to   = bp_displayed_user_url(
     763                            array(
     764                                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ),
     765                            )
     766                        );
    762767                    // Then try 'profile'.
    763768                    } else {
    764                         $redirect_to = trailingslashit( bp_displayed_user_domain() . ( 'xprofile' == $bp->profile->id ? 'profile' : $bp->profile->id ) );
     769                        $profile_slug  = bp_get_profile_slug();
     770                        $redirect_to   = bp_displayed_user_url(
     771                            array(
     772                                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ),
     773                            )
     774                        );
    765775                    }
    766776
    767                     $message     = '';
     777                    $message = '';
    768778                }
    769779
Note: See TracChangeset for help on using the changeset viewer.