Shape the future of Social networking with WordPress: Join Project Midnight Sun! The next generation platform for community building with WordPress!

BuddyDev

Search

[Resolved] How to prevent media comments being added to the activity feed

  • Participant
    Level: Initiated
    Posts: 9
    Geoff Beale on #55892

    quite often when someone adds an image to a gallery we get many short comments added which all then appear in the activity feed. Is there a way to stop the comments being added to the feed?

  • Keymaster
    (BuddyDev Team)
    Posts: 25251
    Brajesh Singh on #55896

    Hi Geoff,
    Thank you for the question.

    Please visit Dashboard->MediaPress->Settings->BuddyPress and disable the section for automatically adding to activity.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 9
    Geoff Beale on #55898

    Hi Brajesh,
    Thanks for your reply.

    I see it’s possible stop new media posts being added to the activity feed.

    I’m happy with that but just want to stop the comments being added to the activity feed. There doesn’t seem to be a setting to disable that.

    Regards,
    Geoff

  • Keymaster
    (BuddyDev Team)
    Posts: 25251
    Brajesh Singh on #55905

    Hi Geoff,
    Thank you for the reply and the clarification.

    The media/gallery comments are internally activity comment/reply. Do you want to disable users from commenting the gallery/media? Otherwise, We can exclude it from main activity stream(by type) and still keep the commenting functionality.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 9
    Geoff Beale on #55906

    Hi Brajesh,

    Thanks for your reply.

    Yes, we want to keep the commenting functionality but exclude the comments from the main activity stream.

    When someone posts a picture it can be tedious when 10 people comment “Nice pic!” lol.

    Regards,
    Geoff

  • Keymaster
    (BuddyDev Team)
    Posts: 25251
    Brajesh Singh on #55916

    Hi Geoff,
    Thank you for your patience.

    Please put this code in bp-custom.php

    
    /**
     * Filters out media comment from activity stream.
     */
    add_filter( 'bp_after_has_activities_parse_args', function ( $args ) {
    
    	if ( isset( $_REQUEST['action'] ) && 'mpp_fetch_activity_media' == $_REQUEST['action'] ) {
    		return $args;
    	}
    
    	if ( function_exists( 'mpp_is_single_media' ) && mpp_is_single_media() ) {
    		return $args;
    	}
    
    	$filters   = isset  ( $args['meta_query'] ) ? (array) $args['meta_query'] : array();
    	$filters[] = array(
    		'key'     => '_mpp_activity_type',
    		'compare' => '!=',
    		'value'   => 'media_comment'
    	);
    
    	$args['meta_query'] = $filters;
    
    	return $args;
    } );
    
    

    It should resolve the issue. Please let me know if it works or not?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 9
    Geoff Beale on #55923

    Thanks, works well, much appreciated.

    Regards,
    Geoff

  • Keymaster
    (BuddyDev Team)
    Posts: 25251
    Brajesh Singh on #55925

    Hi Geoff,
    Thank you for confirming.

    I am glad it worked.

    Regards
    Brajesh

The topic ‘ [Resolved] How to prevent media comments being added to the activity feed’ is closed to new replies.

This topic is: resolved