BuddyDev

Search

[Resolved] Activity Sitewide stream filter posts by category

  • Participant
    Level: Initiated
    Posts: 13
    Plamen Peev on #22370

    Thanks, Brajesh,

    Appreciate your kind assistance.
    The simple logic I’m trying to achieve is to
    allow comments from “community” category blog posts only
    and disallow comments from any other category.

    Can’t wait to test your suggestions tomorrow.
    Will keep you posted.

    Once again – big thank you!

    Plamen

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #22375

    Hi Plamen,
    Thank you.

    Please use the code from my last reply. I am addin git below too

    
    
    function buddydev_disable_activity_blog_comment_recording_conditionally( $enabled, $blog_id, $post_id, $user_id, $comment_id ) {
    
    	// use $post_id to decide.
    	// set $enabled= false; to stop recording comment.
    	if ( ! in_category( 'community', $post_id ) ) {
    		$enabled = false;
    	}
    
    	return $enabled;
    }
    
    add_filter( 'bp_activity_post_pre_comment', 'buddydev_disable_activity_blog_comment_recording_conditionally', 20, 5 );
    
    

    It wills top recording activity for comments which are not on posts from ‘community’ category.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 13
    Plamen Peev on #22394

    Thank you, Brajesh,

    Working just the way I wanted now.

    Bow down to your level of expertise
    and thank you again for your help and kind support.

    All the best,

    Plamen

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #22398

    Hi Plamen,
    Thank you for the kind words.

    I am glad I could assist.

    Have a nice day.

    Regards
    Brajesh

The topic ‘ [Resolved] Activity Sitewide stream filter posts by category’ is closed to new replies.

This topic is: resolved