Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/31/2023 05:26:39 PM (18 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-friends/bp-friends-template.php

    r13441 r13443  
    8989             
    9090            <span>
    91                 <a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() ) ?>">
     91                <a href="<?php bp_displayed_user_link( array( bp_get_friends_slug() ) ); ?>">
    9292                    <?php esc_html_e( 'See All', 'buddypress' ) ?>
    9393                </a>
     
    203203 */
    204204function bp_friend_search_form() {
    205 
    206     $action = bp_displayed_user_domain() . bp_get_friends_slug() . '/my-friends/search/';
    207     $label  = __( 'Filter Friends', 'buddypress' ); ?>
    208 
    209         <form action="<?php echo $action ?>" id="friend-search-form" method="post">
    210 
    211             <label for="friend-search-box" id="friend-search-label"><?php echo $label ?></label>
    212             <input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
     205    $label        = __( 'Filter Friends', 'buddypress' );
     206    $friends_slug = bp_get_friends_slug();
     207    $action       = bp_displayed_user_url(
     208        array(
     209            'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ),
     210            'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ),
     211            'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_search', 'search' ) ),
     212        )
     213    );
     214    ?>
     215
     216        <form action="<?php echo esc_url( $action ) ?>" id="friend-search-form" method="post">
     217
     218            <label for="friend-search-box" id="friend-search-label"><?php echo esc_html( $label ); ?></label>
     219            <input type="search" name="friend-search-box" id="friend-search-box" value="" />
    213220
    214221            <?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
Note: See TracChangeset for help on using the changeset viewer.