/* if member of a group – we want the activity even if nonfriend */
if ( $activity->component != 'groups' && $activity->user_id != 0 && !my_is_friend_check($activity->user_id) && !my_is_atme_check($activity->content) ) {

Into

/* if member of a group – we want the activity even if nonfriend */
if ( $activity->component != 'no_activity_component_shown' && $activity->user_id != 0 && !my_is_friend_check($activity->user_id) && !my_is_atme_check($activity->content) ) {