<+>UTF-8
===================================================================
diff --git a/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-move-topic-to-extension-forum.php b/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-move-topic-to-extension-forum.php
new file mode 100644
--- /dev/null	(date 1642770501997)
+++ b/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-move-topic-to-extension-forum.php	(date 1642770501997)
@@ -0,0 +1,81 @@
+<?php
+
+namespace WordPressdotorg\Forums;
+
+class Move_Topic_To_Extension_Forum {
+
+	public function __construct() {
+		// The plugin and theme forums only exist on the primary forums on WordPress.org/support.
+		if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) && WPORG_SUPPORT_FORUMS_BLOGID == get_current_blog_id() ) {
+			add_action( 'bbp_theme_after_topic_form_forum', array( $this, 'add_edit_topic_field' ) );
+
+			add_action( 'bbp_edit_topic_post_extras', array( $this, 'maybe_move_topic' ) );
+		}
+	}
+
+	/**
+	 * Add the form field for assigning a new plugin or theme location for a topic.
+	 *
+	 * @return void
+	 */
+	public function add_edit_topic_field() {
+		// Only add this field to the edit form, and only for moderators.
+		if ( ! bbp_is_topic_edit() || ! current_user_can( 'moderate' ) ) {
+			return;
+		}
+
+		?>
+
+		<p>
+			<label for="move_topic_to_extension">
+				<?php esc_html_e( 'Move topic to this plugin or theme:', 'wporg-forums' ); ?>
+			</label>
+			<br>
+			<input type="text" size="40" name="move_topic_to_extension" id="move_topic_to_extension" placeholder="https://wordpress.org/plugins/gutenberg/" aria-describedby="move_topic_to_extension_description">
+			<br>
+			<em id="move_topic_to_extension_description">
+				<?php esc_html_e( 'Put in the link to the plugin or theme page on WordPress.org that this topic relates to.', 'wporg-forums' ); ?>
+			</em>
+		</p>
+
+		<?php
+
+	}
+
+	/**
+	 * Change the forum associated with a plugin or theme if applicable.
+	 *
+	 * @param int $topic_id The topic ID being edited.
+	 *
+	 * @return void
+	 */
+	public function maybe_move_topic( $topic_id ) {
+		if ( ! current_user_can( 'moderate' ) ) {
+			return;
+		}
+
+		if ( ! empty( $_POST['move_topic_to_extension'] ) ) {
+			preg_match( '/wordpress\.org\/(?P<type>plugins|themes)\/(?P<slug>.+)\/?/si', $_POST['move_topic_to_extension'], $move_attributes );
+
+			if ( isset( $move_attributes['type'] ) && ! empty( $move_attributes['type'] ) ) {
+				switch ( $move_attributes['type'] ) {
+					case 'plugins':
+						// Clear any theme reference, if set.
+						wp_set_post_terms( $topic_id, '', 'topic-theme', false );
+						// Override the plugin tag with only the new one.
+						wp_set_post_terms( $topic_id, sanitize_title( $move_attributes['slug'] ), 'topic-plugin', false );
+						break;
+					case 'themes':
+						// Clear any plugin reference, if set.
+						wp_set_post_terms( $topic_id, '', 'topic-plugin', false );
+						// Override the theme tag with only the new one.
+						wp_set_post_terms( $topic_id, sanitize_title( $move_attributes['slug'] ), 'topic-theme', false );
+						break;
+				}
+			} else {
+				error_log( 'No matching url ');
+			}
+		}
+	}
+
+}
<+>UTF-8
===================================================================
diff --git a/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin.php b/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin.php
--- a/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin.php	(revision 11461)
+++ b/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin.php	(date 1642770232900)
@@ -37,12 +37,13 @@
 	 * Instantiate a new Plugin object.
 	 */
 	private function __construct() {
-		$this->users        = new Users;
-		$this->user_notes   = new User_Notes;
-		$this->moderators   = new Moderators;
-		$this->hooks        = new Hooks;
-		$this->report_topic = new Report_Topic;
-		$this->nsfw_handler = new NSFW_Handler;
+		$this->users             = new Users;
+		$this->user_notes        = new User_Notes;
+		$this->moderators        = new Moderators;
+		$this->hooks             = new Hooks;
+		$this->report_topic      = new Report_Topic;
+		$this->nsfw_handler      = new NSFW_Handler;
+		$this->move_to_extension = new Move_Topic_To_Extension_Forum;
 
 		// These modifications are specific to https://wordpress.org/support/
 		$blog_id = get_current_blog_id();
<+>UTF-8
===================================================================
diff --git a/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/support-forums.php b/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/support-forums.php
--- a/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/support-forums.php	(revision 11461)
+++ b/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/support-forums.php	(date 1642770197479)
@@ -26,6 +26,7 @@
 include( dirname( __FILE__ ) . '/inc/class-hooks.php' );
 include( dirname( __FILE__ ) . '/inc/class-report-topic.php' );
 include( dirname( __FILE__ ) . '/inc/class-nsfw-handler.php' );
+include( dirname( __FILE__ ) . '/inc/class-move-topic-to-extension-forum.php' );
 
 // Compat-only includes.
 include( dirname( __FILE__ ) . '/inc/class-dropin.php' );
