[buddypress-trac] [BuddyPress] #3460: Support custom post types in activity stream
buddypress-trac
noreply at wordpress.org
Thu Nov 21 02:01:36 UTC 2013
#3460: Support custom post types in activity stream
--------------------------+-----------------------------
Reporter: boonebgorges | Owner: boonebgorges
Type: enhancement | Status: new
Priority: low | Milestone: Future Release
Component: Activity | Version: 1.2.8
Severity: normal | Resolution:
Keywords: |
--------------------------+-----------------------------
Comment (by imath):
Hi,
I've tried to build a patch. I should have read the thread before
following blindly my idea! So this patch won't reply to the need to
"catch" all post types registered. When building it i had in mind, plugin
authors that wish to use the BuddyPress Activity component.
When registering a custom post type, we define various args for the
function {{{register_post_type()}}}. So my idea is to extend in a way
these args by letting plugins define a "bp_tracking" argument and a new
value to the "supports" arg ("bp_tracking"). For instance, the patch could
be used this way in a plugin:
{{{
$labels = array(
'name' => __( 'Post type name', 'plugin_domain' ),
/** etc... **/
);
$tracking_args = array(
'type_post' => 'new_blog_post', // post
activity type
'activity_permalink_post_callback' =>
'callback_function_to_build_permalink_for_post',
'activity_action_post_callback' =>
'callback_function_to_build_action_for_post',
'type_comment' => 'new_blog_comment', //
comment activity type
'activity_action_comment_callback' =>
'callback_function_to_build_action_for_comment',
);
$args_file = array(
'label' => __( 'Post type label', 'plugin_domain' ),
'labels' => $labels_file,
'supports' => array( 'title', 'editor', 'author',
'bp_tracking' ),
'bp_tracking' => $tracking_args
);
}}}
The first thing the patch is doing is to extend the post_type "post" to
include these arguments, i guess it can be done with other post_types..
Then i've modified the two functions {{{bp_blogs_record_post()}}} and
{{{bp_blogs_record_comment()}}} so that they can play with these new
arguments..
I hope the diff 3460.diff attached will help you to find the best
solution.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3460#comment:42>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list