Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Disable group posts from main activity stream

  • @dugfunny

    Participant

    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 3 replies - 1 through 3 (of 3 total)
  • @modemlooper

    Moderator
    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 );

    @dugfunny

    Participant

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

    @dugfunny

    Participant

    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Disable group posts from main activity stream’ is closed to new replies.
Skip to toolbar