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/src/bp-templates/bp-nouveau/buddypress-functions.php

    r13372 r13461  
    55 * @since 3.0.0
    66 * @package BuddyPress
    7  * @version 10.0.0
     7 * @version 12.0.0
    88 *
    99 * @buddypress-template-pack {
     
    177177        add_action( 'bp_actions', array( $this, 'neutralize_core_template_notices' ), 6 );
    178178
    179         // Scripts & Styles.
    180         $registration_params = array(
    181             'hook'     => 'bp_enqueue_community_scripts',
    182             'priority' => 2,
    183         );
    184 
    185         /*
    186          * The WordPress Full Site Editing feature needs Scripts
    187          * and Styles to be registered earlier.
    188          */
    189         if ( current_theme_supports( 'block-templates' ) ) {
    190             $registration_params['hook']     = 'bp_init';
    191             $registration_params['priority'] = 20;
    192         }
    193 
    194         // Register theme JS.
    195         add_action( $registration_params['hook'], array( $this, 'register_scripts' ), $registration_params['priority'] );
     179        // Register scripts & styles.
     180        add_action( 'bp_enqueue_community_scripts', array( $this, 'register_scripts' ), 2 );
    196181
    197182        // Enqueue theme CSS.
Note: See TracChangeset for help on using the changeset viewer.