Skip to:
Content
Pages
Categories
Search
Top
Bottom

threaded comments also show up as top level


  • godavid33
    Participant

    @godavid33

    How can I prevent this? It is a bit redundant and clutter to show comments as single activity posts, when out of context they likely won’t mean anything.

Viewing 3 replies - 1 through 3 (of 3 total)

  • godavid33
    Participant

    @godavid33

    Solution: credit to @lincme on the post https://buddypress.org/support/topic/filtering-out-activity-stream-stuff/

    
    // Remove (hide) various activities from streams.
    function my_hidden_activities($a, $activities) {
    	//if admin we want to know
    	//if (is_site_admin())
    		//return $activities;
    
    	$nothanks = array('activity_comment');
    
    	foreach ($activities->activities as $key => $activity) {
    		if (in_array($activity->type, $nothanks, true)) {
    			unset($activities->activities[$key]);
    			$activities->activity_count = $activities->activity_count-1;
    			$activities->total_activity_count = $activities->total_activity_count-1;
    			$activities->pag_num = $activities->pag_num -1;
    		}
    	}
    
    	// Renumber the array keys to account for missing items.
    	$activities_new = array_values( $activities->activities );
    	$activities->activities = $activities_new;
    
    	return $activities;
    }
    add_action('bp_has_activities', 'my_hidden_activities', 10, 2 );
    

    godavid33
    Participant

    @godavid33

    The above code causes a problem w/ ajax commenting; the content doesn’t immediately display which is a bit troublesome. Any better solution?


    godavid33
    Participant

    @godavid33

    I took a very hacky approach to the activity-loop.php

    changed:

    
    			<?php bp_get_template_part( 'activity/entry' ); ?>
    

    to:

    
    		<?php if(bp_get_activity_type() != "activity_comment"): ?>
    			<?php bp_get_template_part( 'activity/entry' ); ?>
    		<?php endif; ?>
    

    This will almost guaranteed cause problems in the loop keeping track of how many activities there are to display.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘threaded comments also show up as top level’ is closed to new replies.
Skip to toolbar