add_post_type_support( 'product', 'buddypress-activity' );
function customize_page_tracking_args() {
// Check if the Activity component is active before using it.
if ( ! bp_is_active( 'activity' ) ) {
return;
}
bp_activity_set_post_type_tracking_args( 'product', array(
'component_id' => 'activity',
'action_id' => 'new_product',
'bp_activity_admin_filter' => __( 'Published a new badlee',
'custom-domain' ),
'bp_activity_front_filter' => __( 'product', 'twinkools' ),
'contexts' => array( 'activity', 'member' ),
'activity_comment' => true,
'bp_activity_new_post' => __( '%1$s posted a new <a
href="%2$s">product</a>', 'twinkools' ),
'position' => 100,
) );
}
add_action( 'init', 'customize_page_tracking_args', 1000 );
function record_cpt_activity_content_featured_image( $cpt ) {
if ( 'new_product' === $cpt['type'] ) {
global $wpdb, $post, $bp;
$theimg = wp_get_attachment_image_src( get_post_thumbnail_id(
bp_get_activity_secondary_item_id() ), 'large' );
$cpt['content'] .= '<img src="' . $theimg[0] . '">';
}
return $cpt;
}
add_filter('bp_before_activity_add_parse_args','record_cpt_activity_content_featured_image');
Comments