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-activity/bp-activity-template.php

    r13409 r13433  
    10071007            $link = $activities_template->activity->primary_link;
    10081008        } else {
    1009             $link = bp_core_get_user_domain( $activities_template->activity->user_id, $activities_template->activity->user_nicename, $activities_template->activity->user_login );
     1009            $link = bp_members_get_user_url( $activities_template->activity->user_id );
    10101010        }
    10111011
     
    15401540            if ( in_array( $activity_type, array( 'new_avatar', 'new_member', 'friendship_created', 'updated_profile' ), true ) ) {
    15411541                $generated_content->user_url = array(
    1542                     'value'             => bp_core_get_user_domain( $user_id ),
     1542                    'value'             => bp_members_get_user_url( $user_id ),
    15431543                    'sanitize_callback' => 'esc_url',
    15441544                );
     
    22552255     */
    22562256    function bp_get_activity_comment_user_link() {
    2257         $user_link = bp_core_get_user_domain( bp_get_activity_comment_user_id() );
     2257        $user_link = bp_members_get_user_url( bp_get_activity_comment_user_id() );
    22582258
    22592259        /**
     
    36533653
    36543654            // Get profile link for this user.
    3655             $profile_link = bp_core_get_user_domain( $user_id );
     3655            $profile_link = bp_members_get_user_url( $user_id );
    36563656
    36573657            // Get avatar for this user.
Note: See TracChangeset for help on using the changeset viewer.