Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/31/2023 05:26:39 PM (13 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-messages/actions/bulk-manage.php

    r13096 r13443  
    2222    }
    2323
    24     $action   = ! empty( $_POST['messages_bulk_action'] ) ? $_POST['messages_bulk_action'] : '';
    25     $nonce    = ! empty( $_POST['messages_bulk_nonce'] ) ? $_POST['messages_bulk_nonce'] : '';
    26     $messages = ! empty( $_POST['message_ids'] ) ? $_POST['message_ids'] : '';
    27     $messages = wp_parse_id_list( $messages );
     24    $action      = ! empty( $_POST['messages_bulk_action'] ) ? $_POST['messages_bulk_action'] : '';
     25    $nonce       = ! empty( $_POST['messages_bulk_nonce'] ) ? $_POST['messages_bulk_nonce'] : '';
     26    $messages    = ! empty( $_POST['message_ids'] ) ? $_POST['message_ids'] : '';
     27    $messages    = wp_parse_id_list( $messages );
     28    $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action() ) );
     29    $redirect    = bp_displayed_user_url( $path_chunks );
    2830
    2931    // Bail if no action or no IDs.
    3032    if ( ( ! in_array( $action, array( 'delete', 'read', 'unread' ), true ) ) || empty( $messages ) || empty( $nonce ) ) {
    31         bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
     33        bp_core_redirect( $redirect );
    3234    }
    3335
     
    4143        if ( ! messages_check_thread_access( $message ) && ! bp_current_user_can( 'bp_moderate' ) ) {
    4244            bp_core_add_message( __( 'There was a problem managing your messages.', 'buddypress' ), 'error' );
    43             bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
     45            bp_core_redirect( $redirect );
    4446        }
    4547    }
     
    7072
    7173    // Redirect back to message box.
    72     bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
     74    bp_core_redirect( $redirect );
    7375}
    7476add_action( 'bp_actions', 'bp_messages_action_bulk_manage' );
Note: See TracChangeset for help on using the changeset viewer.