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-messages/bp-messages-functions.php

    r13395 r13433  
    627627            'tokens' => array(
    628628                'usermessage' => wp_strip_all_tags( stripslashes( $message ) ),
    629                 'message.url' => esc_url( bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() . '/view/' . $thread_id . '/' ),
     629                'message.url' => esc_url(
     630                    bp_members_get_user_url(
     631                        $recipient->user_id,
     632                        array(
     633                            'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_messages', bp_get_messages_slug() ),
     634                            'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_messages_view', 'view' ),
     635                            'single_item_action_variables' => array( $thread_id ),
     636                        )
     637                    )
     638                ),
    630639                'sender.name' => $sender_name,
    631640                'usersubject' => sanitize_text_field( stripslashes( $subject ) ),
Note: See TracChangeset for help on using the changeset viewer.