Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/18/2023 04:11:04 AM (11 months 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-templates/bp-nouveau/includes/activity/ajax.php

    r13442 r13503  
    115115
    116116            if ( 1 === $fav_count ) {
    117                 $activity_slug          = bp_nouveau_get_component_slug( 'activity' );
    118                 $custom_activity_slug   = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug );
    119                 $activity_favorites_url = bp_loggedin_user_url(
    120                     array(
    121                         'single_item_component' => $custom_activity_slug,
    122                         'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ),
    123                     )
    124                 );
     117                $activity_favorites_url = bp_loggedin_user_url( bp_members_get_path_chunks( array( bp_nouveau_get_component_slug( 'activity' ), 'favorites' ) ) );
    125118
    126119                $response['directory_tab'] = '<li id="activity-favorites" data-bp-scope="favorites" data-bp-object="activity">
Note: See TracChangeset for help on using the changeset viewer.