Skip to content

Commit edb2ae6

Browse files
Merge pull request #512 from buddypress/feature/v2-changes
Setting the plugin to V1
2 parents 2dec281 + 9825e98 commit edb2ae6

28 files changed

+96
-165
lines changed

.github/workflows/coding-standards.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 95 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
11
# BuddyPress RESTful API
22

3-
[![Project Status: Active.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
3+
[![Project Status: Active.](https://www.repostatus.org/badges/latest/inactive.svg)](https://www.repostatus.org/#inactive)
44

55
Access your BuddyPress site's data through an easy-to-use HTTP REST API.
66

77
## Documentation
88

9-
We have extensive documentation of each endpoint/components and their CRUD actions: <https://developer.buddypress.org/bp-rest-api/>
10-
11-
## System Requirements (relevant for CI tests only)
12-
13-
* PHP >= 7.4
14-
* WP >= 6.1
15-
* BuddyPress >= Latest
16-
17-
## Installation
18-
19-
Drop this plugin in the wp-content/plugins directory and activate it. You need at least [WordPress 6.1](https://wordpress.org/download/) and [BuddyPress](https://buddypress.org/download/) to use the plugin.
20-
21-
## About
22-
23-
WordPress is moving towards becoming a fully-fledged application framework. BuddyPress can benefit from this new API by adding endpoints to access social data.
24-
25-
This plugin provides an easy to use REST API Endpoints for BuddyPress, available via HTTP. Grab your
26-
site's data in simple JSON format, including users, groups, xprofile and more.
27-
Retrieving or updating data is as simple as sending a HTTP request.
9+
This plugin has been deprecated since the V2 of the BP REST API was introduced
10+
at [#9145](https://buddypress.trac.wordpress.org/ticket/9145) and is no longer maintained.

bp-rest.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,34 @@ function bp_rest() {
168168
}
169169
add_action( 'bp_rest_api_init', 'bp_rest', 5 );
170170

171+
/**
172+
* Set the current BP REST namespace.
173+
*
174+
* @return string
175+
*/
176+
function bp_filter_v1_rest_current_rest_namespace() {
177+
return 'buddypress';
178+
}
179+
add_filter( 'bp_rest_namespace', 'bp_filter_v1_rest_current_rest_namespace' );
180+
181+
/**
182+
* Set the current BP REST version.
183+
*
184+
* @return string
185+
*/
186+
function bp_filter_v1_rest_current_rest_version() {
187+
return 'v1';
188+
}
189+
add_filter( 'bp_rest_version', 'bp_filter_v1_rest_current_rest_version' );
190+
171191
/**
172192
* Filter the Blog url in the WP_REST_Request::from_url().
173193
*
174194
* @param WP_REST_Request $request Request used to generate the response.
175195
* @param string $url URL being requested.
176196
* @return WP_REST_Request
177197
*/
178-
function bp_filter_rest_request_blog_url( $request, $url ) {
198+
function bp_filter_v1_rest_request_blog_url( $request, $url ) {
179199

180200
if ( ! bp_is_active( 'blogs' ) || empty( $url ) ) {
181201
return $request;
@@ -200,7 +220,7 @@ function bp_filter_rest_request_blog_url( $request, $url ) {
200220

201221
return $request;
202222
}
203-
add_filter( 'rest_request_from_url', 'bp_filter_rest_request_blog_url', 10, 2 );
223+
add_filter( 'rest_request_from_url', 'bp_filter_v1_rest_request_blog_url', 10, 2 );
204224

205225
/**
206226
* Output BuddyPress blog response.
@@ -210,7 +230,7 @@ function bp_filter_rest_request_blog_url( $request, $url ) {
210230
* @param WP_REST_Request $request Request used to generate the response.
211231
* @return WP_REST_Response
212232
*/
213-
function bp_rest_post_dispatch( $response, $instance, $request ) {
233+
function bp_filter_v1_rest_post_dispatch( $response, $instance, $request ) {
214234
if (
215235
! bp_is_active( 'blogs' )
216236
|| 404 !== $response->get_status()
@@ -256,7 +276,7 @@ function bp_rest_post_dispatch( $response, $instance, $request ) {
256276

257277
restore_current_blog();
258278

259-
// Return it, regardless if it was successfull or not.
279+
// Return it, regardless if it was successful or not.
260280
return $response;
261281
}
262-
add_filter( 'rest_post_dispatch', 'bp_rest_post_dispatch', 10, 3 );
282+
add_filter( 'rest_post_dispatch', 'bp_filter_v1_rest_post_dispatch', 10, 3 );

composer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,29 @@
4444
"phpunit": "@test",
4545
"phpcs": "@php ./vendor/bin/phpcs . --basepath=.",
4646
"phpcbf": "@php ./vendor/bin/phpcbf . --basepath=."
47+
},
48+
"archive": {
49+
"exclude": [
50+
"*.xml",
51+
"*.dist",
52+
"*.cache",
53+
"phpcs.xml.dist",
54+
"phpunit.xml.dist",
55+
"wp-env.json",
56+
"composer.json",
57+
"composer.lock",
58+
".editorconfig",
59+
"CHANGELOG.md",
60+
"CONTRIBUTING.md",
61+
"README.md",
62+
".gitignore",
63+
".distignore",
64+
".deployignore",
65+
".github/",
66+
".phpcs/",
67+
"tests/",
68+
"bp-rest-api.zip",
69+
"!vendor/"
70+
]
4771
}
4872
}

includes/bp-activity/classes/class-bp-rest-activity-endpoint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
3030
* @since 0.1.0
3131
*/
3232
public function __construct() {
33+
_deprecated_class( __CLASS__, '15.0.0', 'BP_Activity_REST_Controller' );
34+
3335
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
3436
$this->rest_base = buddypress()->activity->id;
3537
}

includes/bp-blogs/classes/class-bp-rest-attachments-blog-avatar-endpoint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class BP_REST_Attachments_Blog_Avatar_Endpoint extends WP_REST_Controller {
4141
* @since 6.0.0
4242
*/
4343
public function __construct() {
44+
_deprecated_class( __CLASS__, '15.0.0', 'BP_Blogs_Avatar_REST_Controller' );
45+
4446
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
4547
$this->rest_base = buddypress()->blogs->id;
4648
$this->blogs_endpoint = new BP_REST_Blogs_Endpoint();

includes/bp-blogs/classes/class-bp-rest-blogs-endpoint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
2424
* @since 6.0.0
2525
*/
2626
public function __construct() {
27+
_deprecated_class( __CLASS__, '15.0.0', 'BP_Blogs_REST_Controller' );
28+
2729
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
2830
$this->rest_base = buddypress()->blogs->id;
2931
}

includes/bp-components/classes/class-bp-rest-components-endpoint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
2121
* @since 0.1.0
2222
*/
2323
public function __construct() {
24+
_deprecated_class( __CLASS__, '15.0.0', 'BP_Core_Components_REST_Controller' );
25+
2426
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
2527
$this->rest_base = 'components';
2628
}

includes/bp-friends/classes/class-bp-rest-friends-endpoint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class BP_REST_Friends_Endpoint extends WP_REST_Controller {
2424
* @since 6.0.0
2525
*/
2626
public function __construct() {
27+
_deprecated_class( __CLASS__, '15.0.0', 'BP_Friends_REST_Controller' );
28+
2729
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
2830
$this->rest_base = buddypress()->friends->id;
2931
}

0 commit comments

Comments
 (0)