Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/27/2024 09:11:27 PM (2 years ago)
Author:
espellcaste
Message:

Include the V2 of the BP REST API in BuddyPress core.

We are officially deprecating the V1 of the BP REST API. And bundling the new, default, V2 of the BP REST API inside BuddyPress core. Previously, the V1 was developed as a plugin in a separate repo (​https://github.com/buddypress/BP-REST).

  • One of the main differences between the V1 and V2 is how objects are returned. Single items are no longer returned as an array;
  • We have a new BP_Test_REST_Controller_Testcase for testing the new API endpoints;
  • We changed the names of our controllers to follow our autoloader rules;
  • Removed the BP-REST plugin from wp-env and from our release script;
  • And we added notices for the deprecated V1 API (endpoints and files).

Props imath & I. ;)

Fixes #8200
See #9145
Closes ​https://github.com/buddypress/buddypress/pull/337

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/classes/class-bp-friends-component.php

    r13503 r14026  
    140140                                'bp/friends' => array(
    141141                                        'widget_classnames' => array( 'widget_bp_core_friends_widget', 'buddypress' ),
    142                                 )
     142                                ),
    143143                        ),
    144144                );
    … …  
    160160         */
    161161        public function register_nav( $main_nav = array(), $sub_nav = array() ) {
    162                 $slug   = bp_get_friends_slug();
     162                $slug = bp_get_friends_slug();
    163163
    164164                $main_nav = array(
    … …  
    306306                                $bp->bp_options_title = __( 'Friendships', 'buddypress' );
    307307                        } else {
    308                                 $bp->bp_options_avatar = bp_core_fetch_avatar( array(
    309                                         'item_id' => bp_displayed_user_id(),
    310                                         'type'    => 'thumb',
    311                                         'alt'     => sprintf(
     308                                $bp->bp_options_avatar = bp_core_fetch_avatar(
     309                                        array(
     310                                                'item_id' => bp_displayed_user_id(),
     311                                                'type'    => 'thumb',
     312                                                'alt'     => sprintf(
    312313                                                /* translators: %s: member name */
    313                                                 __( 'Profile picture of %s', 'buddypress' ),
    314                                                 bp_get_displayed_user_fullname()
    315                                         ),
    316                                 ) );
    317                                 $bp->bp_options_title = bp_get_displayed_user_fullname();
     314                                                        __( 'Profile picture of %s', 'buddypress' ),
     315                                                        bp_get_displayed_user_fullname()
     316                                                ),
     317                                        )
     318                                );
     319                                $bp->bp_options_title  = bp_get_displayed_user_fullname();
    318320                        }
    319321                }
    … …  
    330332
    331333                // Global groups.
    332                 wp_cache_add_global_groups( array(
    333                         'bp_friends_requests',
    334                         'bp_friends_friendships', // Individual friendship objects are cached here by ID.
    335                         'bp_friends_friendships_for_user' // All friendship IDs for a single user.
    336                 ) );
     334                wp_cache_add_global_groups(
     335                        array(
     336                                'bp_friends_requests',
     337                                'bp_friends_friendships', // Individual friendship objects are cached here by ID.
     338                                'bp_friends_friendships_for_user', // All friendship IDs for a single user.
     339                        )
     340                );
    337341
    338342                parent::setup_cache_groups();
    … …  
    348352         */
    349353        public function rest_api_init( $controllers = array() ) {
    350                 parent::rest_api_init( array( 'BP_REST_Friends_Endpoint' ) );
     354                parent::rest_api_init( array( 'BP_Friends_REST_Controller' ) );
    351355        }
    352356
Note: See TracChangeset for help on using the changeset viewer.