Index: src/includes/extend/buddypress/groups.php
===================================================================
--- src/includes/extend/buddypress/groups.php	(revision 5567)
+++ src/includes/extend/buddypress/groups.php	(working copy)
@@ -98,6 +98,15 @@
 
 		// Adds a hidden input value to the "Group Settings" page
 		add_action( 'bp_before_group_settings_admin', array( $this, 'group_settings_hidden_field'    ) );
+
+		// When a member is banned from a group, unsubscribe from forum and its topics
+		add_action( 'groups_ban_member', 			 array( $this, 'leave_group_unsubscribe', 10, 2) );
+
+		// When a member is removed from a group, unsubscribe from forum and its topics
+		add_action( 'groups_remove_member', 		array( $this, 'leave_group_unsubscribe', 10, 2) );
+
+		// When a member leaves a group, unsubscribe from forum and its topics
+		add_action( 'groups_leave_group', 			array( $this, 'leave_group_unsubscribe', 10, 2) );
 	}
 
 	/**
@@ -1462,5 +1471,60 @@
 
 		return $args;
 	}
+
+	/**
+	 * Unsubscribe user from all forums and topics when leaving a group
+	 *
+	 * @since 
+	 *
+	 * @param int $group_id  ID of the group.
+	 * @param int $user_id The user whose subscriptions need to be deleted.
+	 * @return bool true if any have been deleted
+	 */
+	public function leave_group_unsubscribe( $group_id, $user_id ){
+	
+		//get the forum associated with the group
+		$forums = groups_get_groupmeta( $group_id, 'forum_id' );
+		if( empty( $forums ) ){
+			return false;
+		}
+	
+		foreach( $forums as $forum ){
+			
+			//get a user's forum and topic subscriptions	
+			$forum_subscriptions = bbp_get_user_subscribed_forum_ids( $user_id );
+			$topic_subscriptions = bbp_get_user_subscribed_topic_ids( $user_id );
+		
+			//bail if no subscriptions
+			if( empty( $forum_subscriptions ) && empty( $topic_subscriptions ) ){
+				return false;
+			}
+			
+			$group_forums_subscribed = array_intersect( (array) $forum, $forum_subscriptions );
+			//unsubscribe if subscribed to the forum
+			if( !empty( $group_forums_subscribed ) ){
+				foreach( $group_forums_subscribed as $group_forum_subscribed ){
+					bbp_remove_user_subscription( $user_id, $group_forum_subscribed );
+				}
+			}
+		
+			//get all the child topics for the forum, no matter what they are 
+			$topics = (array) bbp_get_all_child_ids( $forum, 'topic' );
+		
+			//are any of the forum topics in the user's topic subscriptions?
+			$group_topics_subscribed = array_intersect( $topics, $topic_subscriptions );
+	
+			//if they are, unsubscribe them
+			if( !empty( $group_topics_subscribed ) ){
+				foreach( $group_topics_subscribed as $group_topic_subscribed ){
+					bbp_remove_user_subscription( $user_id, $group_topic_subscribed );
+				}
+		
+			}
+		}
+	
+		$unsubs = ( !empty( $group_forums_subscribed ) || !empty( $group_topics_subscribed ) ) ? true : false;
+		return $unsubs;
+	}
 }
 endif;
