Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/07/2023 04:28:08 AM (2 years 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-core/classes/class-bp-core-user.php

    r12791 r13433  
    156156            $full_name_field_name = bp_xprofile_fullname_field_name();
    157157
    158             $this->user_url  = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] );
     158            $this->user_url  = bp_members_get_user_url( $this->id );
    159159            $this->fullname  = esc_attr( $this->profile_data[$full_name_field_name]['field_data'] );
    160160            $this->user_link = "<a href='{$this->user_url}'>{$this->fullname}</a>";
    161161            $this->email     = esc_attr( $this->profile_data['user_email'] );
    162162        } else {
    163             $this->user_url  = bp_core_get_user_domain( $this->id );
     163            $this->user_url  = bp_members_get_user_url( $this->id );
    164164            $this->user_link = bp_core_get_userlink( $this->id );
    165165            $this->fullname  = esc_attr( bp_core_get_user_displayname( $this->id ) );
Note: See TracChangeset for help on using the changeset viewer.