Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/09/2024 03:11:10 AM (5 months ago)
Author:
imath
Message:

Improve the 'bp_rewrites_get_url' filter additional parameters

  • Make sure the first additional parameter $path_chunks contains an unchanged & parsed version of the function original arguments.
  • Add a second additional parameter $args containing the function original arguments.

Props sjregan

Fixes #9060
Closes https://github.com/buddypress/buddypress/pull/213

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-rewrites.php

    r13678 r13691  
    187187        )
    188188    );
     189
     190    // Define the path chunks out of parsed arguments to make them available & unchanged for the 'bp_rewrites_get_url' filter.
     191    $path_chunks = $r;
    189192
    190193    if ( $r['component_id'] && isset( $bp->{$r['component_id']}->rewrite_ids ) ) {
     
    275278
    276279    /**
    277      * Filter here to edit any BudyPress URL.
     280     * Filter here to edit any BuddyPress URL.
    278281     *
    279282     * @since 12.0.0
    280283     *
    281      * @param string $url The BudyPress URL.
    282      * @param array  $r {
     284     * @param string $url The BuddyPress URL.
     285     * @param array  $path_chunks {
    283286     *      Optional. An array of arguments.
    284287     *
     
    294297     *      @type array $single_item_action_variables The list of BuddyPress single item's action variable URL chunks. Defaults [].
    295298     * }
     299     * @param array  $args Original arguments used with the function.
    296300     */
    297     return apply_filters( 'bp_rewrites_get_url', $url, $r );
     301    return apply_filters( 'bp_rewrites_get_url', $url, $path_chunks, $args );
    298302}
    299303
Note: See TracChangeset for help on using the changeset viewer.