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

    r13432 r13433  
    43364336
    43374337        if ( bp_is_active( 'settings' ) ) {
    4338             $redirect_to = sprintf(
    4339                 '%s%s/notifications/',
    4340                 bp_core_get_user_domain( get_current_user_id() ),
    4341                 bp_get_settings_slug()
     4338            $redirect_to = bp_members_get_user_url(
     4339                get_current_user_id(),
     4340                array(
     4341                    'single_item_component' => bp_rewrites_get_slug( 'members', 'member_settings', bp_get_settings_slug() ),
     4342                    'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_settings_notifications', 'notifications' ),
     4343                )
    43424344            );
    43434345        } else {
    4344             $redirect_to = bp_core_get_user_domain( get_current_user_id() );
     4346            $redirect_to = bp_members_get_user_url( get_current_user_id() );
    43454347        }
    43464348
     
    43684370            $redirect_to = sprintf(
    43694371                '%s%s/notifications/',
    4370                 bp_core_get_user_domain( $raw_user_id ),
     4372                bp_members_get_user_url( $raw_user_id ),
    43714373                bp_get_settings_slug()
    43724374            );
    43734375        } else {
    4374             $redirect_to = bp_core_get_user_domain( $raw_user_id );
     4376            $redirect_to = bp_members_get_user_url( $raw_user_id );
    43754377        }
    43764378
     
    43934395        // Template notices are only displayed on BP pages.
    43944396        bp_core_add_message( $message );
    4395         bp_core_redirect( bp_core_get_user_domain( $raw_user_id ) );
     4397        bp_core_redirect( bp_members_get_user_url( $raw_user_id ) );
    43964398
    43974399        exit;
Note: See TracChangeset for help on using the changeset viewer.