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-template.php

    r13432 r13433  
    902902        global $members_template;
    903903
    904         $permalink = bp_core_get_user_domain(
    905             $members_template->member->id,
    906             $members_template->member->user_nicename,
    907             $members_template->member->user_login
    908         );
     904        $permalink = bp_members_get_user_url( $members_template->member->id );
    909905
    910906        /**
     
    20502046
    20512047        if ( bp_displayed_user_id() ) {
    2052             $username = bp_core_get_username( bp_displayed_user_id(), $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login );
     2048            $username = bp_members_get_user_slug( bp_displayed_user_id() );
    20532049        } else {
    20542050            $username = '';
     
    20842080
    20852081        if ( bp_loggedin_user_id() ) {
    2086             $username = bp_core_get_username( bp_loggedin_user_id(), $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login );
     2082            $username = bp_members_get_user_slug( bp_loggedin_user_id() );
    20872083        } else {
    20882084            $username = '';
     
    35723568            $domain  = bp_loggedin_user_domain();
    35733569        } else {
    3574             $domain = bp_core_get_user_domain( (int) $user_id );
     3570            $domain = bp_members_get_user_url( (int) $user_id );
    35753571        }
    35763572
     
    36113607            $domain  = bp_loggedin_user_domain();
    36123608        } else {
    3613             $domain = bp_core_get_user_domain( (int) $user_id );
     3609            $domain = bp_members_get_user_url( (int) $user_id );
    36143610        }
    36153611
Note: See TracChangeset for help on using the changeset viewer.