Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/27/2014 05:13:29 PM (7 years ago)
Author:
imath
Message:

Post Type Activity Tracking feature

So far the tracking feature was requiring the Blogs component to be active. In 2.2 we are centralizing the majority of the tracking code into the Activity component. A new set of functions and hooks has been created to catch public post types supporting the feature 'buddypress-activity' and to automatically generate an activity when a new item is publicly published.

It's now possible to add this support to any public post type using one unique line of code, eg: add_post_type_support( 'page', 'buddypress-activity' ). In this case BuddyPress will use generic activity attributes.
Each activity attribute of the supported post type can be customized using a specific function (eg: set custom strings to describe the post type activity action).

When registering a post type in WordPress it's also possible to set the 'buddypress-activity' feature using the support parameter of the second argument of the register_post_type() function. Custom activity action strings can be defined within the labels parameter and activity attributes can be set using the new parameter 'bp_activity'.

When the Blogs component is active, the 'post' post type is automatically supporting the 'buddypress-activity' feature. The conditional logic (eg: blog_public option set to 1 ...) that occurs before a new activity is posted and the comments tracking remain unchanged.

props boonebgorges, DJPaul

Fixes #5669

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-admin.php

    r9078 r9194  
    799799
    800800    // Walk through the registered actions, and build an array of actions/values.
    801     foreach ( buddypress()->activity->actions as $action ) {
     801    foreach ( bp_activity_get_actions() as $action ) {
    802802        $action = array_values( (array) $action );
    803803
     
    832832
    833833    // Walk through the registered actions, and build an array of actions/values.
    834     foreach ( $bp->activity->actions as $action ) {
     834    foreach ( bp_activity_get_actions() as $action ) {
    835835        $action = array_values( (array) $action );
    836836
     
    13661366
    13671367        // Get the actions
    1368         $activity_actions = buddypress()->activity->actions; ?>
     1368        $activity_actions = bp_activity_get_actions(); ?>
    13691369
    13701370        <div class="alignleft actions">
Note: See TracChangeset for help on using the changeset viewer.