Hi everyone,
More information about it here 👇
Please upgrade 🙏 😉.
Hi everyone,
More information about it here 👇
Please upgrade 🙏 😉.
The first release candidate of BuddyPress 7.0.0 is ready for your testing!
Thanks in advance for your contributions 😍
Hi BuddyPress contributors!
Please join the #BuddyPress developers meeting that will happen on November 18 at 19:00 UTC (tomorrow), we’ll have 1 hour to talk about:
Thanks in advance for your time 😍.
First of all, the Developer documentation has been updated according to the latest improvements we’ve brought to the BuddyPress REST API!
If the Friends component is active and you’re wondering what’s the answer to this question, then you can get a clue thanks to a new property we’ve added to the Members item schema: friendship_status_slug
.
Here’s an example of use of this new property:
/** * Showing the `friendship_status_slug` Members Endpoint's schema property. */ function test_bp_rest_api() { wp_enqueue_script( 'bp-api-request' ); wp_add_inline_script( 'bp-api-request', 'bp.apiRequest( { path: \'buddypress/v1/members\', type: \'GET\', data: { context: \'view\', type: \'active\', exclude: [2] } } ).done( function( data ) { data.forEach( function( member ) { console.log( member.name + \' => \' + member.friendship_status_slug ); } ); } ).fail( function( error ) { return error; } );' ); } add_action( 'bp_enqueue_scripts', 'test_bp_rest_api' );
As you can see in the above browser’s inspector, the logged in user is :
friendship_status_slug: 'not_friends'
),friendship_status_slug: 'pending'
),friendship_status_slug: 'awaiting_response'
),friendship_status_slug
: 'is_friend'
).There’s now a new request argument you can use to know these information : populate_extras
. You simply need to set it to true
to do so. The response will include these extra properties:
last_activity
object which contains 2 properties: date
: the date the user was last active,timediff
: a human diff string, eg: “20 minutes ago”.latest_update
object which contains 3 properties:id
: the ID of the activity,raw
: the content of the activity as it exists into the database.rendered
: the content of the activity ready for output.total_friend_count
variable which contains the number of friends of the user (integer)Here’s an example of use of this new request argument:
/** * Showing the `populate_extras` Members/:user_id request argument. */ function test_bp_rest_api() { wp_enqueue_script( 'bp-api-request' ); wp_add_inline_script( 'bp-api-request', 'bp.apiRequest( { path: \'buddypress/v1/members/2\', type: \'GET\', data: { context: \'view\', populate_extras: true } } ).done( function( member ) { console.log( \'Last activity:\' ); console.log( member.last_activity ); console.log( \'Latest activity update:\' ); console.log( member.latest_update ); console.log( \'Total number of friends:\' ); console.log( member.total_friend_count ); } ).fail( function( error ) { return error; } );' ); } add_action( 'bp_enqueue_scripts', 'test_bp_rest_api' );
Yes you can! You simply need to use a comma separated list of Member Types into the member_type
request arggument when updating/creating the user.
Here’s an example for the first case:
/** * Showing the `member_type` request argument for the members/:user_id endpoint. */ function test_bp_rest_api() { wp_enqueue_script( 'bp-api-request' ); wp_add_inline_script( 'bp-api-request', 'bp.apiRequest( { path: \'buddypress/v1/members/2\', type: \'PUT\', data: { context: \'edit\', member_type: \'leads,developers\' } } ).done( function( member ) { console.log( \'Member Types\' ); console.log( member.member_types ); } ).fail( function( error ) { return error; } );' ); } add_action( 'bp_enqueue_scripts', 'test_bp_rest_api' );
Yes, it’s /buddypress/v1/groups/me
. Querying it you’ll get a list of these groups for the current user.
Here’s an example about how to use it:
/** * Showing the groups/me endpoint. */ function test_bp_rest_api() { wp_enqueue_script( 'bp-api-request' ); wp_add_inline_script( 'bp-api-request', 'bp.apiRequest( { path: \'buddypress/v1/groups/me\', type: \'GET\', data: { context: \'view\' } } ).done( function( groups ) { console.log( \'My Groups\' ); groups.forEach( function( group ) { console.log( group.name ); } ); } ).fail( function( error ) { return error; } );' ); } add_action( 'bp_enqueue_scripts', 'test_bp_rest_api' );
Juste like for the Members Endpoints (GET Members & GET Member), there’s now a new request argument you can use to know these information : populate_extras
. You simply need to set it to true to do so. The response will include these extra properties:
total_member_count
: the count of all Group members,last_activity
: the date the Group was last active,last_activity_diff
: the human diff time the Group was last active.Here’s an example about how to use it:
/** * Showing the `populate_extras` Groups/:group_id request argument. */ function test_bp_rest_api() { wp_enqueue_script( 'bp-api-request' ); wp_add_inline_script( 'bp-api-request', 'bp.apiRequest( { path: \'buddypress/v1/groups/1\', type: \'GET\', data: { context: \'view\', populate_extras: true } } ).done( function( groups ) { groups.forEach( function( group ) { console.log( \'Last activity date:\' ); console.log( group.last_activity ); console.log( \'Last activity time diff:\' ); console.log( group.last_activity_diff ); console.log( \'Total number of group members:\' ); console.log( group.total_member_count ); } ); } ).fail( function( error ) { return error; } );' ); } add_action( 'bp_enqueue_scripts', 'test_bp_rest_api' );
The PUT verb of the Groups/:group_id endpoint now supports 2 new request arguments to achieve this:
append_types
: a string containing the Group Type name to append to existing group’s Group Types. To append more than one Group Type, use a comma separated list of Group Type names.remove_types
: a string containing the Group Type name to remove to existing group’s Group Types. To remove more than one Group Type, use a comma separated list of Group Type names.Here’s an exemple of appending Group Types to the one that is already assigned to the group:
/** * Showing the groups/:group_id update method new request arguments. */ function test_bp_rest_api() { wp_enqueue_script( 'bp-api-request' ); wp_add_inline_script( 'bp-api-request', 'bp.apiRequest( { path: \'buddypress/v1/groups/1\', type: \'PUT\', data: { context: \'view\', append_types: \'team,pizzalovers\' } } ).done( function( groups ) { console.log( \'The initial + appended group types:\' ); groups.forEach( function( group ) { console.log( group.types ); } ); } ).fail( function( error ) { return error; } );' ); } add_action( 'bp_enqueue_scripts', 'test_bp_rest_api' );
Yes, to filter the fetched activities (GET Activities) on one action/type, you need to set the type collection parameter to an array containing the corresponding action/type. For more than one action/type, include all the needed actions/types into the array used as the type collection parameter.
Here’s an example of how to achieve this:
/** * Showing the activity streams filtered on 2 actions/types. */ function test_bp_rest_api() { wp_enqueue_script( 'bp-api-request' ); wp_add_inline_script( 'bp-api-request', 'bp.apiRequest( { path: \'buddypress/v1/activity\', type: \'GET\', data: { context: \'view\', type: [\'activity_update\', \'friendship_created\', \'friendship_accepted\'] } } ).done( function( activities ) { console.log( \'Updates and created friendships:\' ); activities.forEach( function( activity ) { console.log( activity.id + \' => \' + activity.type ); } ); } ).fail( function( error ) { return error; } );' ); } add_action( 'bp_enqueue_scripts', 'test_bp_rest_api' );
groups
when fetching group activities about a specified group_id
request argument?No! From now on the group_id is enough, of course you can still alternatively use a request (GET Activities) having the primary_id
argument set to the ID of the group and the component argument set to groups
.
Here’s an example about how you can use this request argument:
/** * Showing the activity streams filtered on a specific group. */ function test_bp_rest_api() { wp_enqueue_script( 'bp-api-request' ); wp_add_inline_script( 'bp-api-request', 'bp.apiRequest( { path: \'buddypress/v1/activity\', type: \'GET\', data: { context: \'view\', group_id: 1 } } ).done( function( activities ) { console.log( \'Group Activities:\' ); activities.forEach( function( activity ) { console.log( activity.id + \' => \' + activity.component ); } ); } ).fail( function( error ) { return error; } );' ); } add_action( 'bp_enqueue_scripts', 'test_bp_rest_api' );
And last but not least, we’ve added a new route to let users create a blog (POST Blog) when the Network option is allowing it, read more about it from our freshly updated Developers documentation.
PS: if you want to get all examples at once, here’s a Gist.
Hi everyone!
BuddyPress 7.0.0-beta2 is ready for your testing, thanks in advance for your help 🍕 😍
@im4th started the meeting sharing that the ticket (#8179) about the default Blog avatar has been committed and that a developer note has been published on this site. @vapvarun suggested we should respect some consistency about the UI we use when setting a group’s types or a member’s types. A ticket (#8389) has since been reported and fixed: from now on the WP-Admin/Extended Profile’s member type metabox will use checkboxes.
@im4th has updated the BP REST API’s Blogs Endpoint so that it enjoys the improvement we brought about the default Blog avatar (#BP-REST-358). He said he had no time to update the BP REST API developers documentation, but as he felt pretty guilty about it, he worked on it lately and made good progress as only the Signups and Friends Endpoints need a documentation review.
@dcavins has been working on updating the list of Props from our Trac environment and @im4th worked on the list of Props from the BP REST plugin GitHub repository. A patch is ready about these updates (#8376). Here are our progress about 7.0.0 release tasks.
Tasks | Owner | Progress |
BP REST API documentation updates | @im4th | 90% |
BP Survey results | @im4th | 0% |
7.0.0 Release note | @vapvarun | 0% |
7.0.0 Credits update: – BuddyPress Trac – BP REST GitHub repository | @dcavins @im4th | 100% 100% |
7.0.0 Pizza Restaurant name | @dcavins | 🤫 |
7.0.0 Announcement post | @im4th | 0% |
We’ve decided to postpone the 7.0.0-beta2 release to tomorrow (November 11th, 2020). @im4th was concerned about a cache issue (#8388) that was reported lately about the xProfile component. @dcavins volunteered to work on it and has since contributed to 2 patches. Don’t hesitate to comment on the ticket to share with him your thoughts about our 2 possible ways to fix this issue. @vapvarun brought to our attention another issue (#8386) that was reported about the BP Nouveau Template pack. @im4th volunteered to work on it. It has been since fixed. @im4th also asked @vapvarun to test the patch attached to the ticket (#8384) about making sure Site Icons / Blog avatars synchronization is also happening when BuddyPress is not network activated on multisite configurations. He recently tested it and we will probably include it into the 7.0.0-beta2 release. Finally @johnjamesjacoby improved the new strings we introduced about the BP Types UI 🤝. We finally agreed on this new schedule for the 7.0.0 development cycle.
@vapvarun shared his enthusiasm about the promising download results of the BuddyX theme he recently submitted on the WordPress.org Themes Directory 🍕👏📈. As it’s a beautiful BuddyPress theme, @im4th asked him to work on a post to share his experience about the process he had to go through to have his theme hosted on the official Themes Directory. We will soon publish this post on BuddyPress.org 🎨 .
We also talked about the BuddyPress code reference, it’s still under construction but @vapvarun ran some tests about it lately so we might progress about it soon!
It will happen on November 18 at 19:00 UTC and of course in #BuddyPress. If you have ideas or questions, feel free (and we are strongly encouraging you) to comment this summary to share them!
Our next development meeting will happen tomorrow on October 21 at 19:00 UTC in #BuddyPress. Here’s our agenda:
If you have anything you wish to add (or remove) to this agenda or specific items related to those listed above, please leave a comment below.
Hi BuddyPress contributors,
Please help us polish the 7.0.0 release testing its first beta https://buddypress.org/2020/10/buddypress-7-0-0-beta1/ 🙏
Thanks in advance 😉
Hi BuddyPress Plugin/Theme developers,
Since BuddyPress 2.0.0, the primary storage location for the user last_activity
information is the activity
DB table. For backward compatibility reasons, we used to mirror that data into the usermeta
DB table.
This means you could get the last date the user was active on the community site in 2 ways:
bp_get_user_last_activity( $user_id )
function.bp_get_user_meta( $user_id, 'last_activity', false )
function.Please note, starting in BuddyPress 7.0.0, we will stop mirroring the last_activity
user metadata, meaning the only way to get the last date the user was active is by using bp_get_user_last_activity( $user_id )
.
If your development absolutely needs this piece of information to also be available into the usermeta
DB table, then you’ll need to use the following filter to keep it there:
add_filter( 'bp_use_legacy_user_query', '__return_true' );
To read more about this change, see #7882.
Our next development meeting will happen on October 7 (tomorrow) at 19:00 UTC in #BuddyPress. Our agenda:
If you have anything you wish to add (or remove) to this agenda or specific items related to those listed above, please leave a comment below.