[buddypress-trac] [BuddyPress Trac] #3460: Support custom post types in activity stream

buddypress-trac noreply at wordpress.org
Thu Feb 27 23:05:25 UTC 2014


#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:  2nd-opinion has-patch  |
-----------------------------------+-----------------------------

Comment (by imath):

 3460.04.diff is refreshed to latest trunk.

 I improved a few things comparing to 3460.03.diff, taking care of
 backcompat in case plugins / themes were using the filters :
 - bp_blogs_record_post_post_types
 - bp_blogs_record_comment_post_types

 The way it works hasn't changed from 3460.03.diff, tracked post types can
 be by default :
 - the post types created by plugins that are network activated
 - the post types that are set on root blog
 - the post types that are in common between root blog and child blogs


 About the post types that are only "active" on child blogs, it's possible
 to make them trackable by using some filters in
 [http://codex.buddypress.org/plugindev/bp-custom-php/ bp-custom.php], for
 instance :

 {{{
 // to save an activity when a 'my_custom_post_type' is posted
 function child_blog_only_post_type( $tracked_post_type = array() ) {
         if ( ! in_array( 'my_custom_post_type', $tracked_post_type ) )
                 $tracked_post_type['my_custom_post_type'] = 1;

         return $tracked_post_type;
 }
 add_filter( 'bp_blogs_is_blog_post_type_trackable',
 'child_blog_only_post_type', 10, 1 );

 // to add a new action in filter selectboxes of the activity directory and
 of the member profile page
 function test_de_filtre() {
         bp_activity_set_action( buddypress()->blogs->id,
 'new_blog_my_custom_post_type', sprintf( __( 'New %s posted', 'buddypress'
 ), 'my Custom post type' ) );
 }

 add_action( 'bp_blogs_register_activity_actions',
 'child_blog_activity_action' );
 }}}

 There's a way to make things simplier than using these filters for the
 child blog only post types. We can create a new Administration UI that
 would only load on child blogs to create checkboxes for each post type the
 same way {{{bp_admin_setting_callback_post_types_tracked()}}} is building
 the checkbox list for the "network active" post types. Then we could
 "merge" the child blog settings with network one into the
 {{{bp_blogs_is_blog_post_type_trackable()}}} function as one of its
 argument is the blog id.

 Building a UI into child blogs just for this purpose might not worth it...
 On the other hand, it could be a way to have an allow/disallow feature per
 post type / per blog. For instance if the page post type is active on the
 root blog, a child blog could deactivate the page of his blog... Then, we
 would have to think about who can access to this UI : regular admin or
 superadmin only ?

 I think the patch is ready to be tested.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3460#comment:56>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list