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

buddypress-trac noreply at wordpress.org
Fri May 24 18:49:03 UTC 2013


#3460: Support custom post types in activity stream
--------------------------+---------------------------
 Reporter:  boonebgorges  |       Owner:  boonebgorges
     Type:  enhancement   |      Status:  new
 Priority:  low           |   Milestone:  1.8
Component:  Activity      |     Version:  1.2.8
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+---------------------------

Comment (by trishasalas):

 Success (all cpt's are showing in the activity stream with the appropriate
 label)

 Here's the code I added/modified:

 {{{
 //Block all WordPress default post types with the exception of 'post'.
         if ( in_array( $post->post_type, apply_filters(
 'bp_blogs_block_wp_default_post_types', array( 'page', 'revision',
 'nav_menu_item', 'attachment' ) ) ) )
                 return false;

         $is_blog_public = apply_filters( 'bp_is_blog_public',
 (int)get_blog_option( $blog_id, 'blog_public' ) );

         if ( 'publish' == $post->post_status && empty(
 $post->post_password ) ) {
                 if ( $is_blog_public || !is_multisite() ) {

                         // Record this in activity streams
                         $post_permalink = get_permalink( $post_id );

                         // What is a post type?
                         $post_type = get_post_type_object(
 $post->post_type );

                         if ( is_multisite() )
                                 $activity_action  = sprintf( __( '%1$s
 wrote a new %4$s %2$s, on the site %3$s', 'buddypress' ),
 bp_core_get_userlink( (int) $post->post_author ), '<a href="' .
 $post_permalink . '">' . $post->post_title . '</a>', '<a href="' .
 get_blog_option( $blog_id, 'home' ) . '">' . get_blog_option( $blog_id,
 'blogname' ) . '</a>', $post_type->labels->singular_name);

                         else

                                 //Add the post type name to the activity
 sentence
                                  $activity_action  = sprintf( __( '%1$s
 wrote a new %2$s, %3$s', 'buddypress' ), bp_core_get_userlink( (int)
 $post->post_author ), $post_type->labels->singular_name, '<a href="' .
 $post_permalink . '">' . $post->post_title . '</a>');

 }}}

 I am getting a seemingly unrelated error in debug in wp-includes/user.php
 lines 1065 - 1067.  I suspect that's my sloppiness but I wanted to mention
 it.

 Now on to the action sentence :)

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


More information about the buddypress-trac mailing list