Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/04/2023 01:06:03 AM (3 years ago)
Author:
imath
Message:

Use the BP Rewrites API to generate single Groups item links

  • Introduce the bp_groups_get_path_chunks() function to build BP Rewrites arguments using a regular array.
  • Improve bp_members_get_path_chunks() so that it avoids looking for a custom slug when the chunk is a numeric value.
  • Introduce the bp_get_group_manage_url() function to build Group's front-end Admin URLs using BP Rewrites.
  • Deprecate bp_group_admin_permalink() & bp_get_group_admin_permalink() in favor of bp_group_manage_url() & bp_get_group_manage_url().
  • Replace all remaining usage of bp_get_group_permalink() in favor of bp_get_group_url() or bp_get_group_manage_url().

Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-functions.php

    r13443 r13446  
    140140
    141141/**
    142  * Get members path chunks using an array of URL slugs.
     142 * Get single member's path chunks using an array of URL slugs.
    143143 *
    144144 * @since 12.0.0
     
    164164        }
    165165
    166         if ( $chunks && $item_component_rewrite_id_suffix && $item_component_rewrite_id_suffix ) {
     166        if ( $chunks && $item_component_rewrite_id_suffix && $item_action_rewrite_id_suffix ) {
    167167                foreach ( $chunks as $chunk ) {
    168                         $item_action_variable_rewrite_id_suffix        =  str_replace( '-', '_', $chunk );
    169                         $path_chunks['single_item_action_variables'][] = bp_rewrites_get_slug( 'members', 'member_' . $item_component_rewrite_id_suffix . '_' . $item_action_rewrite_id_suffix . '_' . $item_action_variable_rewrite_id_suffix, $chunk );
     168                        if ( is_numeric( $chunk ) ) {
     169                                $path_chunks['single_item_action_variables'][] = $chunk;
     170                        } else {
     171                                $item_action_variable_rewrite_id_suffix        =  str_replace( '-', '_', $chunk );
     172                                $path_chunks['single_item_action_variables'][] = bp_rewrites_get_slug( 'members', 'member_' . $item_component_rewrite_id_suffix . '_' . $item_action_rewrite_id_suffix . '_' . $item_action_variable_rewrite_id_suffix, $chunk );
     173                        }
    170174                }
    171175        }
Note: See TracChangeset for help on using the changeset viewer.