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-groups/bp-groups-notifications.php

    r13293 r13433  
    169169            'group.id'             => $group_id,
    170170            'group-requests.url'   => esc_url( bp_get_group_permalink( $group ) . 'admin/membership-requests' ),
    171             'profile.url'          => esc_url( bp_core_get_user_domain( $requesting_user_id ) ),
     171            'profile.url'          => esc_url( bp_members_get_user_url( $requesting_user_id ) ),
    172172            'requesting-user.id'   => $requesting_user_id,
    173173            'requesting-user.name' => bp_core_get_user_displayname( $requesting_user_id ),
     
    337337    }
    338338
    339     $invited_link = bp_core_get_user_domain( $invited_user_id ) . bp_get_groups_slug();
     339    $invited_link = bp_members_get_user_url(
     340        $invited_user_id,
     341        array(
     342            'single_item_component' => bp_rewrites_get_slug( 'members', 'member_groups', bp_get_groups_slug() ),
     343        )
     344    );
    340345
    341346    $unsubscribe_args = array(
     
    360365            'group.name'     => $group->name,
    361366            'inviter.name'   => bp_core_get_userlink( $inviter_user_id, true, false ),
    362             'inviter.url'    => bp_core_get_user_domain( $inviter_user_id ),
     367            'inviter.url'    => bp_members_get_user_url( $inviter_user_id ),
    363368            'inviter.id'     => $inviter_user_id,
    364369            'invites.url'    => esc_url( $invited_link . '/invites/' ),
     
    12521257            'group.name'      => $group->name,
    12531258            'group.url'       => esc_url( bp_get_group_permalink( $group ) ),
    1254             'leave-group.url' => esc_url( bp_core_get_user_domain( $user_id ) . bp_get_groups_slug() ),
     1259            'leave-group.url' => esc_url(
     1260                bp_members_get_user_url(
     1261                    $user_id,
     1262                    array(
     1263                        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_groups', bp_get_groups_slug() ),
     1264                    )
     1265                )
     1266            ),
    12551267        ),
    12561268    );
Note: See TracChangeset for help on using the changeset viewer.