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/screens/view.php

    r13442 r13503  
    2222    }
    2323
    24     $thread_id           = (int) bp_action_variable( 0 );
    25     $message_slug        = bp_get_messages_slug();
    26     $custom_message_slug = bp_rewrites_get_slug( 'members', 'member_' . $message_slug, $message_slug );
     24    $thread_id = (int) bp_action_variable( 0 );
    2725
    2826    if ( empty( $thread_id ) || ! messages_is_valid_thread( $thread_id ) ) {
     
    3230
    3331        bp_core_redirect(
    34             bp_loggedin_user_url(
    35                 array(
    36                     'single_item_component' => $custom_message_slug,
    37                 )
    38             )
     32            bp_loggedin_user_url( bp_members_get_path_chunks( array( bp_get_messages_slug() ) ) )
    3933        );
    4034    }
     
    5246
    5347            bp_core_redirect(
    54                 bp_loggedin_user_url(
    55                     array(
    56                         'single_item_component' => $custom_message_slug,
    57                     )
    58                 )
     48                bp_loggedin_user_url( bp_members_get_path_chunks( array( bp_get_messages_slug() ) ) )
    5949            );
    6050        }
Note: See TracChangeset for help on using the changeset viewer.