Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/03/2023 06:18:23 AM (2 years ago)
Author:
imath
Message:

Stop using BP Legacy URL parser in favor of the new BP Rewrites API

  • Deprecate bp_core_set_uri_globals(). This function is moved inside the BP Classic compatibility plugin.
  • Introduce the new bp_register_nav action to hook to when globalizing Members single item navigations from the BP_Component class.
  • Improve bp_get_component_navigations() so that Avatar/Cover images navigation items are moved inside the Profile sub nav if the Extended profile component is active.
  • Register Avatar/Cover images Ajax actions so that these actions trigger our new URL Parser inside Ajax context.
  • Improve the BP_Core_Nav::add_nav() method so that any BP action variable slugs can be customized.
  • Improve Members & Groups component canonical redirections.
  • Handle slugs customization persistency using directory pages post metas.
  • Introduce a new repair tool to reset all slugs to BuddyPress default one.
  • Adapt some PHPUnit tests to better handle our new URL parser.

Props Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-core-nav.php

    r13441 r13468  
    201201                $args['link'] = bp_rewrites_get_url( $path_chunks );
    202202            } else {
    203                 $path_chunks['single_item_component'] = bp_rewrites_get_slug( 'members', 'member_' . $path_chunks['single_item_component'], $path_chunks['single_item_component'] );
    204 
    205                 if ( isset( $path_chunks['single_item_action'] ) && ! is_numeric( $path_chunks['single_item_action'] ) ) {
    206                     $path_chunks['single_item_action'] = bp_rewrites_get_slug(
    207                         'members',
    208                         'member_' . $path_chunks['single_item_component'] . '_' . $path_chunks['single_item_action'],
    209                         $path_chunks['single_item_action']
    210                     );
     203                if ( isset( $path_chunks['single_item_component'] ) ) {
     204                    // First try to get custom item action slugs.
     205                    if ( isset( $path_chunks['single_item_action'] ) && ! is_numeric( $path_chunks['single_item_action'] ) ) {
     206                        $path_chunks['single_item_action'] = bp_rewrites_get_slug(
     207                            'members',
     208                            'member_' . $path_chunks['single_item_component'] . '_' . str_replace( '-', '_', $path_chunks['single_item_action'] ),
     209                            $path_chunks['single_item_action']
     210                        );
     211                    }
     212
     213                    // Then only try to get custom item component slug.
     214                    $path_chunks['single_item_component'] = bp_rewrites_get_slug( 'members', 'member_' . str_replace( '-', '_', $path_chunks['single_item_component'] ), $path_chunks['single_item_component'] );
    211215                }
    212216
Note: See TracChangeset for help on using the changeset viewer.