Skip to:
Content

BuddyPress.org

Ticket #3460: cpt-added-to-bp-activity.diff

File cpt-added-to-bp-activity.diff, 2.9 KB (added by trishasalas, 11 years ago)
  • bp-blogs/bp-blogs-functions.php

     
    236236        if ( (int) $blog_id == $tags_blog_id && apply_filters( 'bp_blogs_block_sitewide_tags_activity', true ) )
    237237                return false;
    238238
    239         // Don't record this if it's not a post
    240         if ( !in_array( $post->post_type, apply_filters( 'bp_blogs_record_post_post_types', array( 'post' ) ) ) )
     239        //Block all WordPress default post types with the exception of 'post'. 
     240        if ( in_array( $post->post_type, apply_filters( 'bp_blogs_block_wp_default_post_types', array( 'page', 'revision', 'nav_menu_item', 'attachment' ) ) ) )
    241241                return false;
    242242
    243243        $is_blog_public = apply_filters( 'bp_is_blog_public', (int)get_blog_option( $blog_id, 'blog_public' ) );
     
    246246                if ( $is_blog_public || !is_multisite() ) {
    247247
    248248                        // Record this in activity streams
    249                         $post_permalink   = get_permalink( $post_id );
     249                        $post_permalink = get_permalink( $post_id );
    250250
     251                        //Define a $post_type for our purposes
     252                        $post_type = get_post_type_object( $post->post_type );
     253
     254                        // Add a new string to $activity_action to grab the post_type label
    251255                        if ( is_multisite() )
    252                                 $activity_action  = sprintf( __( '%1$s wrote a new post, %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>' );
     256                                $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>', '<span class="' . lcfirst($post_type->labels->singular_name) . '">' . $post_type->labels->singular_name . '</span>' );
     257
    253258                        else
    254                                 $activity_action  = sprintf( __( '%1$s wrote a new post, %2$s', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
     259                                 $activity_action  = sprintf( __( '%1$s wrote a new %2$s, %3$s', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '<span class="' . lcfirst($post_type->labels->singular_name) . '">' . $post_type->labels->singular_name . '</span>', '<a href="' . $post_permalink . '">' . $post->post_title . '</a>');
    255260
    256261                        // Make sure there's not an existing entry for this post (prevent bumping)
    257262                        if ( bp_is_active( 'activity' ) ) {
     
    743748}
    744749add_action( 'wpmu_delete_user',  'bp_blogs_remove_data' );
    745750add_action( 'delete_user',       'bp_blogs_remove_data' );
    746 add_action( 'bp_make_spam_user', 'bp_blogs_remove_data' );
     751add_action( 'bp_make_spam_user', 'bp_blogs_remove_data' );
     752 No newline at end of file