BuddyDev

Search

Filter post comments from group activity feed

  • Participant
    Level: Master
    Posts: 152
    Hugo Callens on #25912

    I would like to hide post comments, and specifically comments made in specific custom post types, from the group activity feed.

    I found a function to exclude BBPress that seems to come close to what I need (https://buddypress.org/support/topic/block-activity-stream-types/).

    // Filter bbPress from updating activity stream
    function imath_activity_dont_save( $activity_object ) {
    $exclude = array( 'bbp_topic_create', 'bbp_reply_create');
    
    // if the activity type is empty, it stops BuddyPress BP_Activity_Activity::save() function
    if( in_array( $activity_object->type, $exclude ) )
    $activity_object->type = false;
    
    }
    
    add_action('bp_activity_before_save', 'imath_activity_dont_save', 10, 1 ); 

    How can I adapt this to exclude post and cpt comments?

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #25920

    Hello Hugo,

    Thank you for posting. Please make me more clear on the following points.

    1. Do you want to hide all activity created for post comments or want to hide comments on specific post type.
    2. Are you looking for only hide feature or want to restrict user from creating new activity from these posttype.
    3. Are you using Blog categories for groups plugin to create post.

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 152
    Hugo Callens on #25952

    Hi Ravi,

    1. I would like to specifically hide comments in the Learndash post types course, module, topic and quiz (I run a Learndash course inside this group).
    2. I am only looking to hide these comments in the group’s activity feed, because they are connected to separate Learndash groups inside the course, and should only there be visible. User should still be able to post comments.
    3. I use Blog categories for groups. Regular posts and comments created here should still be visible in the group feed.

    Thank you for your help!

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #25976

    Hi Hugo,
    Thank you for the clarification.

    My suggestion will be to ask learndash team. They are the one most probably recording the activity(BuddyPresss does not associate any blog post/comment with group).

    They might have already provided a filter. If not, they should be able to easily add a filter and assist you.

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: not resolved