Skip to:
Content
Pages
Categories
Search
Top
Bottom

Disable record activity

  • Profile photo of mika89
    mika89
    Participant

    @mika89

    Hello everyone,

    I’d like to disable the “record_activity” action when a frienship is created. I know that we just can hide it in the activity loop by applying a filter. But I want to disable the activity for a certain user ID and a certain type (or action ??) which is “friendship_created”.

    I tried this but doesn’t work:

    function my_denied_activity_new_frienship( $a, $activities ) {
        foreach ( $activities->activities as $key => $activity ) {
        	if($activity->user_id == BP_MEMBER_ID){
        		if ( $activity->action =='friendship_created') {
    	            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;
            	}
        	}
           
        }
     
        //On construit le nouveau tableau avec les bonnes cl├ęs
        $activities_new = array_values( $activities->activities );
        $activities->activities = $activities_new;
     
        return $activities;
    }
    add_action('bp_has_activities','my_denied_activity_new_member', 10, 2 );
Viewing 1 replies (of 1 total)
  • Profile photo of mika89
    mika89
    Participant

    @mika89

    By the way it’s add_action('bp_has_activities','my_denied_activity_new_friendship', 10, 2 );

Viewing 1 replies (of 1 total)
  • The topic ‘Disable record activity’ is closed to new replies.