[buddypress-trac] [BuddyPress Trac] #7156: Build REST-API endpoints for all Components.

buddypress-trac noreply at wordpress.org
Sun Jun 23 11:04:38 UTC 2019


#7156: Build REST-API endpoints for all Components.
----------------------------------------------+--------------------------
 Reporter:  DJPaul                            |       Owner:  espellcaste
     Type:  feature request                   |      Status:  accepted
 Priority:  strategic                         |   Milestone:  5.0.0
Component:  REST API                          |     Version:
 Severity:  normal                            |  Resolution:
 Keywords:  needs-docs needs-codex has-patch  |
----------------------------------------------+--------------------------
Changes (by imath):

 * keywords:  needs-docs needs-codex => needs-docs needs-codex has-patch


Comment:

 Hi,

 I know we are still thinking about what is the best option between merging
 or including into a build step the BP REST API. Reading the thread of the
 ticket makes me feel, and I agree about this choice, that we can wait
 until all the remaining endpoints are built into the BP REST plugin before
 merging. It's the choice that leaves us all options: as @boonebgorges said
 during dev-chat "''once we go Trac, we can't go back''".

 So I've been thinking about this scenario and built the
 [https://buddypress.trac.wordpress.org/attachment/ticket/7156/7156.patch
 7156.patch]. Here's what it does :

 - put the REST Controllers into their components class directory (eg: `src
 /bp-activity/classes/class-bp-rest-activity-endpoint.php),
 - make sure all `@since 0.1.0` are replaced by `@since 5.0.0`,
 - make sure the `buddypress.pot` is generated after the REST endpoints
 have been added to the build directory.
 - copy the functions listed into the `/includes/functions.php` file of the
 BP REST plugin into `src/bp-core/bp-core-rest-api.php`. (PS: I've added a
 [https://github.com/buddypress/BP-REST/pull/188 pull-request] about what
 needs to be done into the BP REST plugin about this).
 - update the class autoloader for the REST Controllers.
 - add a new method `rest_api_init()` to `BP_Component` and the components
 having REST controllers.
 - make sure these methods are only used when the WordPress version of the
 site is > `4.7.0` and the BP REST plugin is not active.

 On a side note I had to edit a unit test that was deleting the
 $_SERVER['SERVER_NAME'] global. Feedbacks welcome 😉

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7156#comment:8>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list