Index: bp-groups.php
===================================================================
--- bp-groups.php	(revision 3138)
+++ bp-groups.php	(working copy)
@@ -364,14 +364,19 @@
 				check_admin_referer( 'bp_forums_new_reply' );
 
 				/* Auto join this user if they are not yet a member of this group */
-				if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
+				$is_auto_joined = false;
+				if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
 					groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
+					$is_auto_joined = true;
+				}
 
 				if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) )
 					bp_core_add_message( __( 'There was an error when replying to that topic', 'buddypress'), 'error' );
 				else
 					bp_core_add_message( __( 'Your reply was posted successfully', 'buddypress') );
 
+				do_action( 'bp_groups_after_forum_post', $bp->loggedin_user->id, $bp->groups->current_group->id, $is_auto_joined );
+
 				if ( $_SERVER['QUERY_STRING'] )
 					$query_vars = '?' . $_SERVER['QUERY_STRING'];
 
@@ -542,14 +547,19 @@
 				check_admin_referer( 'bp_forums_new_topic' );
 
 				/* Auto join this user if they are not yet a member of this group */
-				if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
+				$is_auto_joined = false;
+				if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
 					groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
+					$is_auto_joined = true;
+				}
 
 				if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) )
 					bp_core_add_message( __( 'There was an error when creating the topic', 'buddypress'), 'error' );
 				else
 					bp_core_add_message( __( 'The topic was created successfully', 'buddypress') );
 
+				do_action( 'bp_groups_after_forum_post', $bp->loggedin_user->id, $bp->groups->current_group->id, $is_auto_joined );
+
 				bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' );
 			}
 
