Index: support-forums/inc/class-moderators.php
===================================================================
--- support-forums/inc/class-moderators.php	(revision 12226)
+++ support-forums/inc/class-moderators.php	(working copy)
@@ -64,6 +64,11 @@
 		add_action( 'bbp_approved_reply',               array( $this, 'store_moderator_username' ) );
 		add_action( 'bbp_unapproved_topic',             array( $this, 'store_moderator_username' ) );
 		add_action( 'bbp_unapproved_reply',             array( $this, 'store_moderator_username' ) );
+
+		// Clean up after posts are removed from public view
+		add_action( 'bbp_spammed_reply', array( $this, 'fix_pagination_after_remove' ) );
+		add_action( 'bbp_deleted_reply', array( $this, 'fix_pagination_after_remove' ) );
+		add_action( 'wporg_bbp_archived_reply', array( $this, 'fix_pagination_after_remove' ) );
 	}
 
 	/**
@@ -1064,4 +1069,23 @@
 
 		return $topic_status;
 	}
+
+	/**
+	 * Repaginate a thread after a reply is spammed/deleted/archived.
+	 *
+	 * @param int $reply_id ID of removed reply.
+	 */
+	public function fix_pagination_after_remove( $reply_id ) {
+		if ( $reply_id ) {
+			if ( $topic_id = bbp_get_reply_topic_id( $reply_id ) ) {
+				$all_reply_ids_in_thread = bbp_get_all_child_ids( $topic_id, bbp_get_reply_post_type() );
+				if ( $all_reply_ids_in_thread ) {
+					foreach ( $all_reply_ids_in_thread as $_reply_id ) {
+						$r = bbp_update_reply_position( $_reply_id );
+					}
+				}
+			}
+		}
+	}
+
 }
