Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/03/2023 06:18:23 AM (3 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/bp-core-functions.php

    r13461 r13468  
    160160     *                       Possible values are `rewrites` or `legacy`.
    161161     */
    162     return apply_filters( 'bp_core_get_query_parser', bp_has_pretty_urls() ? 'legacy' : 'rewrites' );
     162    return apply_filters( 'bp_core_get_query_parser', 'rewrites' );
    163163}
    164164
     
    958958            $site         = get_site_by_path( $current_site->domain, trailingslashit( $current_site->path ) . $slug );
    959959
    960             if ( isset( $site->blog_id ) && 1 !== $site->blog_id ) {
     960            if ( isset( $site->blog_id ) && 1 !== (int) $site->blog_id ) {
    961961                $illegal_names[] = $slug;
    962962            }
     
    49574957
    49584958        if ( isset( $component->sub_nav ) && is_array( $component->sub_nav ) && $component->sub_nav ) {
     4959            // We possibly need to move some members nav items.
     4960            if ( 'members' === $key_component && isset( $navigations['profile']['sub_nav'] ) ) {
     4961                $profile_subnav_slugs = wp_list_pluck( $navigations['profile']['sub_nav'], 'slug' );
     4962                foreach ( $component->sub_nav as $members_subnav ) {
     4963                    if ( 'profile' === $members_subnav['parent_slug'] && ! in_array( $members_subnav['slug'], $profile_subnav_slugs, true ) ) {
     4964                        $navigations['profile']['sub_nav'][] = $members_subnav;
     4965                    }
     4966                }
     4967            }
     4968
    49594969            $navigations[ $key_component ]['sub_nav'] = $component->sub_nav;
    49604970        }
Note: See TracChangeset for help on using the changeset viewer.