Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-version-dropdown/inc/class-plugin.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-version-dropdown/inc/class-plugin.php	(revision 5135)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-version-dropdown/inc/class-plugin.php	(working copy)
@@ -9,7 +9,8 @@
 	 */
 	private static $instance;
 
-	const META_KEY = 'wp_version';
+	const META_KEY         = 'wp_version';
+	const PROJECT_META_KEY = 'project_version';
 
 	/**
 	 * Returns always the same instance of this plugin.
@@ -51,63 +52,157 @@
 	}
 
 	/**
-	 * Output value topic version dropdown
+	 * Output version dropdown values for the topic.
 	 */
 	public function form_topic_version_dropdown() {
-		$version = 0;
-		$other_version = '';
-		$versions = $this->get_wp_versions();
+		$wp_version = 0;
+		$wp_other_version = '';
+		$wp_versions = $this->get_wp_versions();
 
 		// Post value passed
 		if ( bbp_is_topic_form_post_request() && isset( $_POST[ self::META_KEY ] ) ) {
-			$version = $this->sanitize_wp_version( $_POST[ self::META_KEY ] );
+			$wp_version = $this->sanitize_version( $_POST[ self::META_KEY ] );
 
 		// No post value passed
 		} else if ( bbp_is_single_topic() || bbp_is_topic_edit() ) {
-			$version = $this->get_topic_version( array( 'id' => bbp_get_topic_id() ) );
-			if ( false === $version ) {
-				$version = 0;
+			$topic_versions = $this->get_topic_version( array( 'id' => bbp_get_topic_id() ) );
+			$wp_version     = $topic_versions['wp_version'];
+
+			if ( false === $wp_version ) {
+				$wp_version = 0;
 			}
 		}
 
-		if ( ! empty( $version ) && ! array_key_exists( $version, $versions ) ) {
-			$other_version = $version;
-			$version = 'other';
+		if ( ! empty( $wp_version ) && ! array_key_exists( $wp_version, $wp_versions ) ) {
+			$wp_other_version = $wp_version;
+			$wp_version = 'other';
 		}
 		?>
 		<p>
-			<label for="wp-version"><?php esc_html_e( 'Version:', 'wporg-forums' ); ?></label><br />
+			<label for="wp-version"><?php esc_html_e( 'WordPress Version:', 'wporg-forums' ); ?></label><br />
 			<em><?php esc_html_e( 'Select the version of WordPress you are using.', 'wporg-forums' ); ?></em><br />
 
 			<select name="<?php echo esc_attr( self::META_KEY ); ?>" id="wp-version">
-				<?php foreach ( $versions as $key => $label ) : ?>
-					<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $version ); ?>><?php echo esc_html( $label ); ?></option>
+				<?php foreach ( $wp_versions as $key => $label ) : ?>
+					<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $wp_version ); ?>><?php echo esc_html( $label ); ?></option>
 				<?php endforeach; ?>
 			</select>
 
-			<label for="wp-other-version"><?php esc_html_e( 'Enter a different WordPress version here:', 'wporg-forums' ); ?></label>
-			<input type="text" name="wp_other_version" id="wp-other-version" value="<?php echo esc_attr( $other_version ); ?>">
+			<label for="wp-other-version"><?php esc_html_e( 'Enter a different version here:', 'wporg-forums' ); ?></label>
+			<input type="text" name="wp_other_version" id="wp-other-version" value="<?php echo esc_attr( $wp_other_version ); ?>">
 		</p>
 		<?php
+		if ( ! class_exists( '\WordPressdotorg\Forums\Plugin' ) ) {
+			return;
+		}
+
+		$project        = null;
+		$plugin_instance = \WordPressdotorg\Forums\Plugin::get_instance();
+
+		if ( ! empty( $plugin_instance->plugins->plugin ) ) {
+			$project          = $plugin_instance->plugins->plugin;
+			$project_type     = 'plugin';
+			$project_versions = $this->get_project_versions( $project_type, $project->post_name );
+
+			$label = __( 'Plugin Version:', 'wporg-forums' );
+			/* translators: %s: plugin name */
+			$hint = _x( 'Select the version of %s you are using.', 'plugin', 'wporg-forums' );
+		} elseif ( ! empty( $plugin_instance->themes->theme ) ) {
+			$project          = $plugin_instance->themes->theme;
+			$project_type     = 'theme';
+			$project_versions = $this->get_project_versions( $project_type, $project->post_name );
+
+			$label = __( 'Theme Version:', 'wporg-forums' );
+			/* translators: %s: theme name */
+			$hint = _x( 'Select the version of %s you are using.', 'theme', 'wporg-forums' );
+		}
+
+		if ( ! $project ) {
+			return;
+		}
+
+		$project_version = 0;
+		$project_other_version = '';
+
+		// Post value passed
+		if ( bbp_is_topic_form_post_request() && isset( $_POST[ self::PROJECT_META_KEY ] ) ) {
+			$project_version = $this->sanitize_version( $_POST[ self::PROJECT_META_KEY ] );
+
+		// No post value passed
+		} else if ( bbp_is_single_topic() || bbp_is_topic_edit() ) {
+			$project_version = $topic_versions['project_version'];
+
+			if ( false === $project_version ) {
+				$project_version = 0;
+			}
+		}
+
+		if ( ! empty( $project_version ) && ! array_key_exists( $project_version, $project_versions ) ) {
+			$project_other_version = $project_version;
+			$project_version = 'other';
+		}
+		?>
+		<p>
+			<label for="project-version"><?php echo esc_html( sprintf( $label, $project->post_title ) ); ?></label><br />
+			<em><?php echo esc_html( sprintf( $hint, $project->post_title ) ); ?></em><br />
+
+			<select name="<?php echo esc_attr( self::PROJECT_META_KEY ); ?>" id="project-version">
+				<?php foreach ( $project_versions as $key => $label ) : ?>
+					<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $project_version ); ?>><?php echo esc_html( $label ); ?></option>
+				<?php endforeach; ?>
+			</select>
+
+			<label for="project-other-version"><?php esc_html_e( 'Enter a different version here:', 'wporg-forums' ); ?></label>
+			<input type="text" name="project_other_version" id="project-other-version" value="<?php echo esc_attr( $project_other_version ); ?>">
+
+			<input type="hidden" name="project_type" value="<?php echo esc_attr( $project_type ); ?>" />
+			<input type="hidden" name="project_slug" value="<?php echo esc_attr( $project->post_name ); ?>" />
+		</p>
+		<?php
 	}
 
+	/**
+	 * Process topic form submission.
+	 *
+	 * @param int $topic_id Topic ID.
+	 */
 	public function topic_post_extras( $topic_id ) {
-		$version = false;
-		$versions = $this->get_wp_versions();
-		if ( ( $_POST[ self::META_KEY ] ) && in_array( $_POST[ self::META_KEY ], $versions ) ) {
-			$version = $this->sanitize_wp_version( $_POST[ self::META_KEY ] );
+		$wp_version  = false;
+		$wp_versions = $this->get_wp_versions();
+
+		if ( ( $_POST[ self::META_KEY ] ) && in_array( $_POST[ self::META_KEY ], $wp_versions ) ) {
+			$wp_version = $this->sanitize_version( $_POST[ self::META_KEY ] );
 		} else if ( isset( $_POST['wp_other_version'] ) ) {
-			$version = $this->sanitize_wp_version( $_POST['wp_other_version'] );
+			$wp_version = $this->sanitize_version( $_POST['wp_other_version'] );
 		}
 
-		if ( false !== $version ) {
+		$project_version = false;
+
+		if ( isset( $_POST['project_type'] ) && isset( $_POST['project_slug'] ) ) {
+			$project_type = sanitize_title_for_query( $_POST['project_type'] );
+			$project_slug = sanitize_title_for_query( $_POST['project_slug'] );
+
+			$project_versions = $this->get_project_versions( $project_type, $project_slug );
+
+			if ( ( $_POST[ self::PROJECT_META_KEY ] ) && in_array( $_POST[ self::PROJECT_META_KEY ], $project_versions ) ) {
+				$project_version = $this->sanitize_version( $_POST[ self::PROJECT_META_KEY ] );
+			} else if ( isset( $_POST['project_other_version'] ) ) {
+				$project_version = $this->sanitize_version( $_POST['project_other_version'] );
+			}
+		}
+
+		if ( false !== $wp_version || false !== $project_version ) {
 			$this->set_topic_version( array(
-				'id' => $topic_id,
-				'version' => $version
+				'id'              => $topic_id,
+				'wp_version'      => $wp_version,
+				'project_version' => $project_version,
 			) );
 		}
 	}
 
+	/**
+	 * Enqueue plugin scripts.
+	 */
 	public function enqueue_scripts() {
 		if (
 			bbp_is_single_forum() || bbp_is_single_topic() || bbp_is_topic_edit()
@@ -118,6 +213,17 @@
 		}
 	}
 
+	/**
+	 * Get version data for a particular topic.
+	 *
+	 * @param array $args Array of arguments. Accepts 'id'.
+	 * @return array {
+	 *     Topic versions.
+	 *
+	 *     @type string $wp_version      WordPress version.
+	 *     @type string $project_version Plugin or theme version.
+	 * }
+	 */
 	public static function get_topic_version( $args = array() ) {
 
 		// Parse arguments against default values
@@ -131,16 +237,32 @@
 			return;
 		}
 
-		$retval = get_post_meta( $topic->ID, self::META_KEY, true );
+		$wp_version      = get_post_meta( $topic->ID, self::META_KEY, true );
+		$project_version = get_post_meta( $topic->ID, self::PROJECT_META_KEY, true );
+
+		$retval = compact( 'wp_version', 'project_version' );
+
 		return apply_filters( 'get_topic_version', $retval, $r, $args );
 	}
 
+	/**
+	 * Set version data for a particular topic.
+	 *
+	 * @param array {
+	 *     Array of arguments.
+	 *
+	 *     @type int    $id              Topic ID.
+	 *     @type string $wp_version      WordPress version.
+	 *     @type string $project_version Plugin or theme version.
+	 * }
+	 */
 	public function set_topic_version( $args = array() ) {
 
 		// Parse arguments against default values
 		$r = bbp_parse_args( $args, array(
-			'id'      => 0,
-			'version' => '',
+			'id'              => 0,
+			'wp_version'      => '',
+			'project_version' => '',
 		), 'set_topic_version' );
 
 		$topic = bbp_get_topic( $r['id'] );
@@ -149,24 +271,120 @@
 			return;
 		}
 
-		if ( empty( $r['version'] ) ) {
-			delete_post_meta( $r['id'], self::META_KEY );
-		} else {
-			update_post_meta( $r['id'], self::META_KEY, $r['version'] );
+		if ( false !== $r['wp_version'] ) {
+			if ( empty( $r['wp_version'] ) ) {
+				delete_post_meta( $r['id'], self::META_KEY );
+			} else {
+				update_post_meta( $r['id'], self::META_KEY, $r['wp_version'] );
+			}
 		}
+
+		if ( false !== $r['project_version'] ) {
+			if ( empty( $r['project_version'] ) ) {
+				delete_post_meta( $r['id'], self::PROJECT_META_KEY );
+			} else {
+				update_post_meta( $r['id'], self::PROJECT_META_KEY, $r['project_version'] );
+			}
+		}
 	}
 
+	/**
+	 * Get the list of WordPress core versions.
+	 *
+	 * @return array Array of WordPress versions.
+	 */
 	public function get_wp_versions() {
 		$versions = array_merge(
 			array( '0' => '' ),
 			apply_filters( 'wporg_bbp_get_wp_versions', array() ),
-			/* translators: WordPress Version */
+			/* translators: WordPress version */
 			array( 'other' => __( 'Other:', 'wporg-forums' ) )
 		);
 		return $versions;
 	}
 
-	public function sanitize_wp_version( $version ) {
+	/**
+	 * Get the list of plugin or theme versions from the directory.
+	 *
+	 * @param string $type Project type. Accepts 'plugin' or 'theme'.
+	 * @param string $slug Project slug.
+	 * @return array Array of project versions, keyed by version.
+	 */
+	public function get_project_versions( $type, $slug ) {
+		// Check the cache.
+		$cache_key   = $slug;
+		$cache_group = $type . '-versions';
+		$versions    = wp_cache_get( $cache_key, $cache_group );
+
+		if ( false !== $versions ) {
+			return $versions;
+		}
+
+		$versions = array();
+
+		if ( 'plugin' === $type && get_site( WPORG_PLUGIN_DIRECTORY_BLOGID ) ) {
+
+			switch_to_blog( WPORG_PLUGIN_DIRECTORY_BLOGID );
+
+			$projects = get_posts( array(
+				'name'           => $slug,
+				'post_type'      => 'plugin',
+				'post_status'    => array( 'publish', 'pending', 'disabled', 'closed', 'draft', 'approved' ),
+				'posts_per_page' => 1,
+			) );
+
+			if ( $projects ) {
+				$project  = reset( $projects );
+				$versions = get_post_meta( $project->ID, 'tagged_versions', true );
+				$versions = array_combine( $versions, $versions );
+			}
+
+			restore_current_blog();
+
+		} elseif ( 'theme' === $type && get_site( WPORG_THEME_DIRECTORY_BLOGID ) ) {
+
+			switch_to_blog( WPORG_THEME_DIRECTORY_BLOGID );
+
+			$projects = get_posts( array(
+				'name'           => $slug,
+				'post_type'      => 'repopackage',
+				'post_status'    => array( 'publish', 'pending', 'draft', 'future', 'trash', 'suspend' ),
+				'posts_per_page' => 1,
+			) );
+
+			if ( $projects ) {
+				$project       = reset( $projects );
+				$versions_meta = get_post_meta( $project->ID, '_status', true );
+
+				if ( $versions_meta ) {
+					$versions = array_keys( $versions_meta );
+					$versions = array_combine( $versions, $versions );
+				}
+			}
+
+			restore_current_blog();
+
+		}
+
+		$versions = array_merge(
+			array( '0' => '' ),
+			apply_filters( 'wporg_bbp_get_project_versions', $versions, $type, $slug ),
+			/* translators: plugin or theme version */
+			array( 'other' => __( 'Other:', 'wporg-forums' ) )
+		);
+
+		wp_cache_set( $cache_key, $versions, $cache_group, DAY_IN_SECONDS );
+
+		return $versions;
+	}
+
+	/**
+	 * Sanitize version value.
+	 *
+	 * @param string $version Version value.
+	 * @return string Sanitized value.
+	 */
+	public function sanitize_version( $version ) {
 		return preg_replace( '#[^0-9a-z.-]#i', '', $version );
 	}
 }
Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-version-dropdown/wporg-bbp-version-dropdown.js
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-version-dropdown/wporg-bbp-version-dropdown.js	(revision 5135)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-version-dropdown/wporg-bbp-version-dropdown.js	(working copy)
@@ -3,8 +3,8 @@
 
 	var Plugin = {
 		initialize: function () {
-			var $otherVersion = $( '#wp-other-version' );
-			var $label = $( 'label[for=wp-other-version]' );
+			var $otherVersion = $( 'input[id$="-other-version"]' );
+			var $label = $( 'label[for$="-other-version"]' );
 
 			if ( ! $otherVersion.length ) {
 				return;
@@ -16,7 +16,7 @@
 			$otherVersion.hide();
 			$label.hide();
 
-			var $wpVersion = $( '#wp-version' );
+			var $wpVersion = $( 'select[id$="-version"]' );
 			if ( ! $wpVersion.length ) {
 				return;
 			}
@@ -27,13 +27,17 @@
 		},
 
 		updateOtherVersion: function () {
-			if ( 'other' == $( this ).val() ) {
-				Plugin.$label.show();
-				Plugin.$otherVersion.show().focus();
-			} else {
-				Plugin.$label.hide();
-				Plugin.$otherVersion.hide();
-			}
+			$( this ).each( function () {
+				var index = ( 'wp-version' === $( this ).attr( 'id' ) ) ? 0 : 1;
+
+				if ( 'other' == $( this ).val() ) {
+					Plugin.$label.eq( index ).show();
+					Plugin.$otherVersion.eq( index ).show().focus();
+				} else {
+					Plugin.$label.eq( index ).hide();
+					Plugin.$otherVersion.eq( index ).hide();
+				}
+			});
 		}
 	};
 
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php	(revision 5135)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php	(working copy)
@@ -548,12 +548,25 @@
 	$voice_count = sprintf( _n( '%s participant', '%s participants', $voice_count, 'wporg-forums' ), bbp_number_format( $voice_count ) );
 	$last_reply  = bbp_get_topic_last_active_id( $topic_id );
 
-	// WP version
-	$wp_version = '';
+	// WP and plugin/theme versions
+	$wp_version = $project_version = $project_type = '';
+
 	if ( function_exists( 'WordPressdotorg\Forums\Version_Dropdown\get_topic_version' ) ) {
-		$wp_version = WordPressdotorg\Forums\Version_Dropdown\get_topic_version( $topic_id );
+		$topic_versions  = WordPressdotorg\Forums\Version_Dropdown\get_topic_version( $topic_id );
+		$wp_version      = $topic_versions['wp_version'];
+		$project_version = $topic_versions['project_version'];
 	}
 
+	if ( class_exists( 'WordPressdotorg\Forums\Plugin' ) ) {
+		$plugin_instance = WordPressdotorg\Forums\Plugin::get_instance();
+
+		if ( ! empty( $plugin_instance->plugins->plugin ) ) {
+			$project_type = 'plugin';
+		} elseif ( ! empty( $plugin_instance->themes->theme ) ) {
+			$project_type = 'theme';
+		}
+	}
+
 	?>
 
 	<li class="topic-forum"><?php
@@ -588,6 +601,9 @@
 	<?php if ( ! empty( $wp_version ) ) : ?>
 		<li class="wp-version"><?php echo esc_html( $wp_version ); ?></li>
 	<?php endif; ?>
+	<?php if ( ! empty( $project_type ) && ! empty( $project_version ) ) : ?>
+		<li class="<?php echo esc_attr( $project_type ); ?>-version"><?php echo esc_html( $project_version ); ?></li>
+	<?php endif; ?>
 	<?php if ( function_exists( 'WordPressdotorg\Forums\Topic_Resolution\get_topic_resolution_form' ) ) : ?>
 		<?php if ( WordPressdotorg\Forums\Topic_Resolution\Plugin::get_instance()->is_enabled_on_forum() && ( bbp_is_single_topic() || bbp_is_topic_edit() ) ) : ?>
 			<li class="topic-resolved"><?php WordPressdotorg\Forums\Topic_Resolution\get_topic_resolution_form( $topic_id ); ?></li>
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/sass/style-original.scss
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/sass/style-original.scss	(revision 5135)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/sass/style-original.scss	(working copy)
@@ -228,6 +228,14 @@
 	content: "\f120";
 }
 
+.sidebar .topic-info li.plugin-version:before {
+	content: "\f106";
+}
+
+.sidebar .topic-info li.theme-version:before {
+	content: "\f100";
+}
+
 .sidebar .topic-info li.topic-resolved:before {
 	content: "\f546";
 }
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/style-rtl.css
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/style-rtl.css	(revision 5135)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/style-rtl.css	(working copy)
@@ -420,6 +420,14 @@
 	content: "\f120";
 }
 
+.sidebar .topic-info li.plugin-version:before {
+	content: "\f106";
+}
+
+.sidebar .topic-info li.theme-version:before {
+	content: "\f100";
+}
+
 .sidebar .topic-info li.topic-resolved:before {
 	content: "\f546";
 }
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/style.css
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/style.css	(revision 5135)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/style.css	(working copy)
@@ -420,6 +420,14 @@
 	content: "\f120";
 }
 
+.sidebar .topic-info li.plugin-version:before {
+	content: "\f106";
+}
+
+.sidebar .topic-info li.theme-version:before {
+	content: "\f100";
+}
+
 .sidebar .topic-info li.topic-resolved:before {
 	content: "\f546";
 }
