Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add Woocommerce Products to Activity Stream


  • Leandro
    Participant

    @leandrorocha

    Hello,

    I am looking for a way to add products, and others custom post types, to buddypress activity stream. I was able to achieve this using the following code however now the comment button is not appearing anymore in the activity stream, neither for products, neither for posts.


    add_filter ( 'bp_blogs_record_post_post_types', 'activity_publish_custom_post_types' );
    function activity_publish_custom_post_types( $post_types ) {
    $post_types[] = 'product';
    return $post_types;
    }

    add_filter('bp_blogs_activity_new_post_action', 'record_cpt_activity_action', 1, 3);
    function record_cpt_activity_action($activity_content, $post, $post_permalink){
    if( $post->post_type == 'product' ) {
    $activity_content = sprintf( __( '%1$s added or updated a product: %2$s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '' . $post->post_title . '' );
    }

    return $activity_content;
    }

    Anyone can help me to debug this issue? Seems that the problem is related with the first part of the code since if I remove it I am able to comment again.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar