Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/24/2023 02:32:27 AM (20 months ago)
Author:
imath
Message:

Make canonical redirection & Ajax requesting BP Rewrites ready

  • Introduces bp_core_setup_query_parser() to decide when to postpone some key hooks firing to bp_parse_query.
  • Introduces bp_core_get_query_parser() to get the query parser in use. It contains a filter BP Classic will be able to use to force the Legacy URL parser. So far it uses legacy for pretty links and rewrites for plain links.
  • Edit bp_redirect_canonical() & bp_get_canonical_url() so that they use the BP Rewrites API.
  • Introduces bp_core_set_ajax_uri_globals() to set the BuddyPress URI globales using the BP Rewrites API inside the Ajax context thanks to the updated bp_reset_query() function.
  • To avoid using WP() at each Ajax call, introduces a simple Ajax actions registration process thanks to the new bp_ajax_register_action().
  • Update Legacy & Nouveau template packs so that they use this logic. As BP Default will require the legacy URL parser and will be moved inside BP Classic, the theme can stay the way it is.
  • Improve the bp_rewrites_pre_get_slug filter logic making it depends on the bp_core_get_query_parser() function.
  • Make sure to reset the Members navigation to a new BP_Core_Nav based on the displayed user once the user is available in the component's parse_query() method.

Props r-a-y, johnjamesjacoby, boonebgorges

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/routing/root-profiles.php

    r13431 r13461  
    88    protected $old_current_user = 0;
    99    protected $u;
     10    protected $permalink_structure = '';
    1011
    1112    public function set_up() {
     
    2122        $this->u = new WP_User( $uid );
    2223        $this->set_current_user( $uid );
     24        $this->permalink_structure = get_option( 'permalink_structure', '' );
    2325    }
    2426
     
    2628        parent::tear_down();
    2729        $this->set_current_user( $this->old_current_user );
     30        $this->set_permalink_structure( $this->permalink_structure );
    2831        remove_filter( 'bp_core_enable_root_profiles', '__return_true' );
    2932    }
    3033
    3134    public function test_members_directory() {
     35        $this->set_permalink_structure( '/%postname%/' );
    3236        $this->go_to( home_url( bp_get_members_root_slug() ) );
    3337
     
    3943
    4044    public function test_member_permalink() {
     45        $this->set_permalink_structure( '/%postname%/' );
    4146        $domain = home_url( $this->u->user_nicename );
    4247        $this->go_to( $domain );
     
    5156     */
    5257    public function test_member_permalink_when_members_page_is_nested_under_wp_page() {
     58        $this->set_permalink_structure( '/%postname%/' );
    5359        $p = self::factory()->post->create( array(
    5460            'post_type' => 'page',
     
    7177
    7278    public function test_member_activity_page() {
     79        $this->set_permalink_structure( '/%postname%/' );
    7380        $url = home_url( $this->u->user_nicename ) . '/' . bp_get_activity_slug();
    7481        $this->go_to( $url );
Note: See TracChangeset for help on using the changeset viewer.