Skip to:
Content
Pages
Categories
Search
Top
Bottom

Disable group posts from main activity stream

  • Avatar of dugfunny
    dugfunny
    Participant

    @dugfunny

    How can i do it?

    I still want groups to be able to have their own, separate activity streams, but i want that information kept inside of their group, or if someone presses the “My Groups” tab at the top of the main activity page it should show up.

    Otherwise I don’t want group updates showing up on the main activity “wall”.

    Here is code I am using so far concerning what I want to show on the activity wall…

    /**
     * Activity Stream Default Updates
     */
    function make_swa_show_notice_only( $retval ) {	
    	
    	 if ( bp_is_page( 'activity' ) ) {
    		$retval['action'] = 'activity_update, rtmedia_update, forums_update, bbp_topic_create, bbp_reply_create';					
    	 }
    	
    	return $retval;
    	
    }
    add_filter( 'bp_after_has_activities_parse_args', 'make_swa_show_notice_only' );

    This basically makes only status updates, rtmedia updates(photos and such), and forum updates show up on my activity “Wall”. How can i tweak this code to NOT allow group updates to come through?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    function bp_filter_groups_from_activity( $a, $activities ) {
    
    	if ( bp_is_current_component( 'activity' ) ) {
    		foreach ( $activities->activities as $key => $activity ) {
    			
    			if ( $activity->component =='groups') {
    				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;
    			}
    		}
    		 
    		$activities_new = array_values( $activities->activities );
    		$activities->activities = $activities_new;
    		 	
    	}
    	return $activities;
    }
    add_action('bp_has_activities','bp_filter_groups_from_activity', 10, 2 );
    Avatar of dugfunny
    dugfunny
    Participant

    @dugfunny

    wow thanks for the fast response @modemolooper ! You want me to replace the code I already have with that or put that somewhere else?

    Avatar of dugfunny
    dugfunny
    Participant

    @dugfunny

    okay, i posted it right below the above mentioned code in

    /wp-content/plugins/bp-custom.php

    and it seems to have worked! Thanks so much man!

    Avatar of alyssonlago
    alyssonlago
    Participant

    @alyssonlago

    This works but when I click on “My Groups” tab at the top of the main activity page the posts are not showing up.
    Any help to make this work?

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

You must be logged in to reply to this topic.