BP Dev Chat agenda: September 18, 2019.

This is the agenda for our next Dev Chat which will happen this Wednesday (tomorrow) at 19:00 UTC in #BuddyPress.

  • 5.0.0-RC1 first feedbacks.
  • A first version of the BP REST API Documentation site is ready. Let’s discuss about how to announce it to our community.
  • 5.0.0 remaining tasks :
    • Announcement post,
    • Release page on the Codex,
    • Recent rockstars & release props,
    • 🍕 name for the release!

If you have anything you wish to add to this agenda or specific items related to those listed above, please leave a comment below.


BuddyPress 5.0.0 Release Candidate

Hi everyone,

The release candidate of BuddyPress 5.0.0 is available for testing. Read more about it in this announcement post.

Thanks in advance for your tests 😍

#5-0-0, #rc

New Invitations API Coming in BuddyPress 5.0

As part of BuddyPress 5.0, we’ve included a new core API for managing invitations. This API stores data in a new table, bp_invitations, and introduces new classes to handle working with invitations stored in the new table. The API clears the way for the development of useful  features like site invitations (hopefully coming in 5.1) but starts by handling group invitations and membership requests.

For most users and developers, the changes will be subtle. Existing group invitations will be migrated to the invitations table, and the current behaviors have been maintained. Managing invitations and requests will still be accomplished using familiar functions like groups_invite_user() or groups_accept_membership_request(). Queries made using BP_Group_Member_Query will continue to work as expected.

However, if you are directly querying the bp_groups_members table to find invitations and membership requests, these queries will no longer work, since the pending memberships will be stored in the new bp_invitations table. Happily, we’ve introduced several new functions, like groups_get_invites() and groups_get_requests(), that make finding invitations easier and more reliable.

The signatures of several functions have changed from accepting one or two parameters to accepting an array of parameters to support the new flexibility of the underlying API. The following functions now accept an array of parameters and will issue a deprecation notice if standard parameters are passed into them:

  • groups_send_invites()
  • groups_send_membership_request()

Three membership request management functions have also changed from accepting a membership_id as the first parameter to relying on the user_id and group_id parameters to find the correct request to change:

  • groups_accept_membership_request()
  • groups_reject_membership_request()
  • groups_delete_membership_request()

Other improvements include the following:

  • BP_Invitation objects are cached
  • Queries made via the BP_Invitation class are cached
  • Extension is straightforward; see BP_Groups_Invitation_Manager for an example
  • Many scattered direct queries have been replaced by calls to the API
  • Messages included in invitations and requests are now included in the notice email

If you have any questions or comments, please let us know.

bp.apiRequest(), your JavaScript Buddy to help you start using the BP REST API

In BuddyPress 5.0.0 (Release date ~ September 30, 2019), we’re introducing the BP REST API: a new way for BuddyPress developers to interact with the components of BuddyPress powered community sites.

If you’re familiar with the WordPress REST API, you should easily find out how to use the BP REST API as it extends it to provide new community oriented endpoints.

The BP REST API, just like the WP REST API, uses a cookie authentication. You need 4 things to get a response from one of the BP REST API endpoints :

  1. The rest_nonce
  2. The WP REST root URL rest_url()
  3. One of the available BuddyPress endpoint’s path, for example /buddypress/v1/members
  4. The transport method (GET, POST, PUT, DELETE, OPTIONS).

You can build everything yourself into your JS script making sure to carry points 1. & 2. from PHP using the wp_localize_script() function.

You can also add a dependency to bp-api-request when enqueueing your JS script to :

  • save some time ⏱
  • make sure it will work for all the WordPress versions BuddyPress supports (4.7 to latest) 😅

Adding a dependency to bp-api-request

    'your-plugin-js-handle', // The handle to use when enqueueing your script.
        'bp-api-request', // The dependency to add to use the bp.apiRequest function.
    '1.2.3', // Your plugin version.
    true     // True to load your script into the footer. False otherwise.

Doing so, you’ll just need to enqueue your JavaScript file at the right time and for the right context using wp_enqueue_script( 'your-plugin-js-handle' ) without having to care about the REST nonce and the WP REST root URL.

function your_plugin_enqueue_assets() {
    // Only loads the JavaScript when a user is viewing his profile.
    if ( bp_is_my_profile() ) {
        wp_enqueue_script( 'your-plugin-js-handle' );
add_action( 'bp_enqueue_scripts', 'your_plugin_enqueue_assets' );

Using bp.apiRequest() within your JS script

The only elements you’ll have to care about are:

You’ll need to group all these elements into an object looking like the highlighted lines below:

( function( bp, $ ) {
    window.bpRestApiResponse = {};

    var helloBPApiRequest = function() {
        bp.apiRequest( {
            path: '/buddypress/v1/members/me',
            type: 'GET',
            data: {
                context: 'view',
        } ).done( function( data ) {
            bpRestApiResponse = data;
        } ).fail( function( error ) {
            alert( error.message );
        } );
    $( document ).ready( helloBPApiRequest );
} )( window.bp || {}, jQuery );

From there, If you log the bpRestApiResponse variable into your browser’s console when visiting your BuddyPress profile you’ll see the JSON object the BP REST API should respond to you.

Oh.. wait but how can I get all BuddyPress endpoint paths etc. ?

We wrote a complete documentation with an example of use for each endpoint. We will soon make it available on the BuddyPress.org network.

In the meantime, if you’re eager to have some fun with the BP REST API, simply replace /buddypress/v1/members/me with /buddypress/v1 into the helloBPApiRequest()function of the above example.

Logging bpRestApiResponse will now give you all available endpoints, their corresponding transport methods and arguments for your community site (The ones of your active BuddyPress components) 😉


BuddyPress 5.0.0-beta2 📢

Hi BuddyPress contributors!

Guess what, BuddyPress 5.0.0-beta2 is available for testing!

Read more about it here


BP Dev Chat Summary, September 4

5.0.0’s schedule

  1. Second beta release: September 10.
  2. First release candidate: ~ September 16.
  3. 5.0.0 release: ~ September 30.

Issues & Feedbacks about the first beta release

Some i18n issues appeared into the BP REST API code and have since been fixed by @espellcaste. @im4th will improve the bp.apiRequest JavaScript function before beta2 (#8131).

IAmTheWebb reported that he hasn’t noticed any regression issues but also informed us he hasn’t found the time to test the new features yet. The lack of ticket report is a bit worrying as it makes us wonder if the beta1 has actually been tested by BuddyPress plugin or theme developers 🤔.

@boonebgorges explained it wasn’t easy to test the BP REST API as it required building clients. Having the BP REST API documentation site available would probably help.

The BP REST API documentation site

@johnjamesjacoby & @netweb have been working on the developer.wordpress.org needed set-up to host the BP REST API documentation site. Although we are very confident they will soon fix #4601-meta, we decided to wait until September 20 before applying our backup plan.

In case we can’t make it on developer.wordpress.org @im4th will buy a specific domain name for the staging site we used to write the documentation and we’ll make this site widely available.

BuddyPress plugin & theme developers will be able to consult The BP REST API documentation before the 5.0.0 release 💯.

Hello BuddyPress modal

BuddyPress 3.0.0 introduced this modal to replace the Welcome Screen. We use it to inform about the new features introduced in the new major releases of BuddyPress.

@im4th shared a patch on #8132 to make this modal more inline with the WordPress Administration styles. @johnjamesjacoby shared his thoughts about it on the ticket and agreed during dev-chat that matching core’s modal would be best.

@im4th is 🇫🇷 so there are probably some english mistakes in the text parts of the patch. BuddyPress contributors : don’t hesitate to find and fix them 🙏


We decided to package a second beta next week to remind our contributors we need their help to test our contributions. Let’s not wait for the stable release to find bugs we could have avoided during the beta period!

Next dev-chat

It will happen on September 18th at 19:00 UTC in #BuddyPress slack channel, just before the release candidate.

PS: @dcavins couldn’t attend to the dev-chat but recently shared in our Slack channel he will soon publish an overview about the changes introduced by the BP Invitations API 👌.


BP Dev Chat agenda: September 4, 2019.

This is the agenda for our next Dev Chat which will happen this Wednesday (tomorrow) at 19:00 UTC in #BuddyPress.

  • 5.0.0-beta1 feedbacks & issues 🏜
  • BP REST API Documentation site 🔥
  • Hello BuddyPress 5.0.0 #8132 🤔
  • Should we publish a 5.0.0-beta2 ? 📣

If you have anything you wish to add to this agenda or specific items related to those listed above, please leave a comment below.