Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/31/2023 05:26:39 PM (20 months ago)
Author:
imath
Message:

Make sure all displayed user URLs are built using the BP Rewrites API

Replace all remaining bp_displayed_user_domain() usage in favor of
bp_displayed_user_url().
Introduce the bp_members_get_path_chunks() function to quickly build BP
Rewrites argument for member's URL using an array of slugs.
Deprecate bp_activities_member_rss_link(), bp_blogs_blog_tabs() &
bp_groups_header_tabs().
Improve bp_displayed_user_link() so that it's possible to pass an array
of slugs to output an escaped BP Rewrites ready URL.

Props r-a-y, johnjamesjacoby, boonebgorges

Closes https://github.com/buddypress/buddypress/pull/79
See #4954

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-settings/actions/general.php

    r13395 r13443  
    5151    $feedback      = array();                // array of strings for feedback.
    5252    $user_id       = bp_displayed_user_id(); // The ID of the user being displayed.
     53    $settings_slug = bp_get_settings_slug();
     54    $path_chunks   = array(
     55        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug ),
     56    );
    5357
    5458    // Nonce check.
     
    100104
    101105                    bp_update_user_meta( $user_id, 'pending_email_change', $pending_email );
    102                     $verify_link = bp_displayed_user_domain() . bp_get_settings_slug() . '/?verify_email_change=' . $hash;
     106                    $verify_link = add_query_arg(
     107                        'verify_email_change',
     108                        $hash,
     109                        bp_displayed_user_url( $path_chunks )
     110                    );
    103111
    104112                    // Send the verification email.
     
    227235
    228236    // Set the URL to redirect the user to.
    229     $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_settings_slug() . '/general' );
     237    $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_general', 'general' );
     238    $redirect_to = bp_displayed_user_url( $path_chunks );
    230239
    231240    /**
     
    262271    }
    263272
    264     $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_settings_slug() );
     273    $settings_slug = bp_get_settings_slug();
     274    $path_chunks   = array(
     275        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug )
     276    );
     277    $redirect_to = bp_displayed_user_url( $path_chunks );
    265278
    266279    // Email change is being verified.
Note: See TracChangeset for help on using the changeset viewer.