Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/07/2023 04:28:08 AM (14 months ago)
Author:
imath
Message:

BP Rewrites: Introduce the bp_members_get_user_url() function

As many member URLs are built concatenating bp_core_get_user_domain()
with URL chunks, the safer way to make sure developers update the way they
build their member URLs in favor of using BP Rewrites is:

  1. to deprecate this function
  2. create a new function bp_members_get_user_url() which is a wrapper of

bp_rewrites_get_url()

  1. replace all bp_core_get_user_domain() occurrences by

bp_members_get_user_url()

This commit also deprecates bp_core_get_username() in favor of the new
bp_members_get_user_slug() function and updates PHPUnit tests.

Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-blocks.php

    r13296 r13433  
    4444
    4545    // Mention variables.
    46     $username   = bp_core_get_username( $member_id );
     46    $username   = bp_members_get_user_slug( $member_id );
    4747    $at_mention = '';
    4848
     
    5858    // Member name variables.
    5959    $display_name = bp_core_get_user_displayname( $member_id );
    60     $member_link  = bp_core_get_user_domain( $member_id );
     60    $member_link  = bp_members_get_user_url( $member_id );
    6161
    6262    // Member action button.
     
    230230
    231231        // Get Member link.
    232         $member_link = bp_core_get_user_domain( $member->ID );
     232        $member_link = bp_members_get_user_url( $member->ID );
    233233
    234234        // Set the Avatar output.
     
    483483                    'php',
    484484                    array(
    485                         'data.link'              => bp_core_get_user_domain( $user->ID, $user->user_nicename, $user->user_login ),
     485                        'data.link'              => bp_members_get_user_url( $user->ID ),
    486486                        'data.name'              => $user->display_name,
    487487                        'data.avatar_urls.thumb' => bp_core_fetch_avatar(
     
    633633                    </a>
    634634                </div>',
    635                 esc_url( bp_core_get_user_domain( $member->ID, $member->user_nicename, $member->user_login ) ),
     635                esc_url( bp_members_get_user_url( $member->ID ) ),
    636636                esc_html( $member->display_name ),
    637637                bp_core_fetch_avatar(
Note: See TracChangeset for help on using the changeset viewer.