Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/27/2024 09:11:27 PM (15 months 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-notifications/classes/class-bp-notifications-component.php

    r13503 r14026  
    146146     */
    147147    public function register_nav( $main_nav = array(), $sub_nav = array() ) {
    148         $slug   = bp_get_notifications_slug();
     148        $slug = bp_get_notifications_slug();
    149149
    150150        // Add 'Notifications' to the main navigation.
     
    248248                );
    249249            } else {
    250                 $title  = _x( 'Notifications', 'My Account Notification',         'buddypress' );
    251                 $unread = _x( 'Unread',        'My Account Notification sub nav', 'buddypress' );
     250                $title  = _x( 'Notifications', 'My Account Notification', 'buddypress' );
     251                $unread = _x( 'Unread', 'My Account Notification sub nav', 'buddypress' );
    252252            }
    253253
     
    297297            } else {
    298298                $bp->bp_options_title  = bp_get_displayed_user_fullname();
    299                 $bp->bp_options_avatar = bp_core_fetch_avatar( array(
    300                     'item_id' => bp_displayed_user_id(),
    301                     'type'    => 'thumb',
    302                     /* translators: %s: member name */
    303                     'alt'     => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_get_displayed_user_fullname() )
    304                 ) );
     299                $bp->bp_options_avatar = bp_core_fetch_avatar(
     300                    array(
     301                        'item_id' => bp_displayed_user_id(),
     302                        'type'    => 'thumb',
     303                        /* translators: %s: member name */
     304                        'alt'     => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_get_displayed_user_fullname() ),
     305                    )
     306                );
    305307            }
    306308        }
     
    317319
    318320        // Global groups.
    319         wp_cache_add_global_groups( array(
    320             'bp_notifications',
    321             'notification_meta',
    322             'bp_notifications_unread_count',
    323             'bp_notifications_grouped_notifications',
    324         ) );
     321        wp_cache_add_global_groups(
     322            array(
     323                'bp_notifications',
     324                'notification_meta',
     325                'bp_notifications_unread_count',
     326                'bp_notifications_grouped_notifications',
     327            )
     328        );
    325329
    326330        parent::setup_cache_groups();
     
    336340     */
    337341    public function rest_api_init( $controllers = array() ) {
    338         parent::rest_api_init( array( 'BP_REST_Notifications_Endpoint' ) );
     342        parent::rest_api_init( array( 'BP_Notifications_REST_Controller' ) );
    339343    }
    340344}
Note: See TracChangeset for help on using the changeset viewer.