Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/18/2023 04:11:04 AM (2 years ago)
Author:
imath
Message:

BP Rewrites: optimize the code used to build URLs

The bp_members_get_path_chunks() & bp_groups_get_path_chunks() functions are making sure URL chunks are customized according to the slugs settings. Instead of redoing at many places all or some of the operations performed by these functions, update the code to build URLs so that it uses these functions.

See #4954
Fixes #8923
Closes https://github.com/buddypress/buddypress/pull/117

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-notifications.php

    r13442 r13503  
    2525 */
    2626function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    27     $total_items         = (int) $total_items;
    28     $text                = '';
    29     $message_slug        = bp_get_messages_slug();
    30     $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug );
    31     $link                = bp_loggedin_user_url(
    32         array(
    33             'single_item_component' => $custom_message_slug,
    34             'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $message_slug . '_inbox', 'inbox' ),
    35         )
    36     );
    37     $title               = __( 'Inbox', 'buddypress' );
    38     $amount              = 'single';
     27    $total_items = (int) $total_items;
     28    $text        = '';
     29    $link        = bp_loggedin_user_url( bp_members_get_path_chunks( array( bp_get_messages_slug(), 'inbox' ) ) );
     30    $title       = __( 'Inbox', 'buddypress' );
     31    $amount      = 'single';
    3932
    4033    if ( 'new_message' === $action ) {
Note: See TracChangeset for help on using the changeset viewer.