BuddyPress 2.2 to Add Custom Post Type Support to the Activity Stream

BuddyPress 2.2 is shaping up to be an exciting release, packed full of new features for developers. Support for Composer will be included in 2.2, as well as a basic member type API, which will allow developers to create different user types.

The upcoming 2.2 release will also introduce the ability for new activity items to be generated when content is created by registered post types. This is a feature that already exists within the BuddyPress’ blogs component and will be extended to include custom post types that declare support for it. Developers will be able to add support for CPTs with one simple line of code:

[php light=”true”]add_post_type_support( ‘book’, ‘buddypress-activity’ );[/php]

This will publish updates to the activity stream for the post type that you specify, using generic strings. The BuddyPress codex has already been updated to show examples for how you can get more control over the activity attributes when you register the post type.

“This update is about the first step of it: ease the implementation of tracking the published post type items into the Activity stream,” BuddyPress core developer Mathieu Viet explained in the announcement on the BP development blog.

When post type support is added to the activity stream, you will also be able to sort the new items via the activity dropdown filters. This filter is available on the frontend and in the backend.

These improvements are all recent additions to BuddyPress trunk. If you want to test 2.2 alpha, checkout BuddyPress trunk via SVN or download the zip file. Activate it and then add support for a custom post type that is active on your BuddyPress test site.

The ticket that houses the discussion on this issue has been open for three years. BuddyPress 2.2 finally answers this request and gives plugin developers a beautifully simple implementation for adding post type support to the activity stream.