Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/22/2024 01:11:00 AM (9 months ago)
Author:
espellcaste
Message:

Deprecate bp-api-request properly.

The bp.apiRequest function was deprecated in BuddyPress 10.0.0, but still was being hooked into bp_init.

We are moving the related code to deprecated/10.0.php, and we are encouraging developers to use wp.apiRequest instead in the BP REST API documentation.

Props imath.

See #9145
Closes https://github.com/buddypress/buddypress/pull/383

File:
1 edited

Legend:

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

    r13877 r14048  
    5959    return $wp_hook;
    6060}
     61
     62/**
     63 * Register the jQuery.ajax wrapper for BP REST API requests.
     64 *
     65 * @since 5.0.0
     66 * @deprecated 10.0.0
     67 */
     68function bp_rest_api_register_request_script() {
     69    _deprecated_function( __FUNCTION__, '10.0.0' );
     70
     71    if ( ! bp_rest_api_is_available() ) {
     72        return;
     73    }
     74
     75    wp_register_script(
     76        'bp-api-request',
     77        sprintf( '%1$sbp-core/js/bp-api-request%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ),
     78        array( 'jquery', 'wp-api-request' ),
     79        bp_get_version(),
     80        true
     81    );
     82
     83    wp_localize_script(
     84        'bp-api-request',
     85        'bpApiSettings',
     86        array(
     87            'unexpectedError'   => __( 'An unexpected error occurred. Please try again.', 'buddypress' ),
     88            'deprecatedWarning' => __( 'The bp.apiRequest function is deprecated since BuddyPress 10.0.0, please use wp.apiRequest instead.', 'buddypress' ),
     89        )
     90    );
     91}
Note: See TracChangeset for help on using the changeset viewer.